File size: 947 Bytes
618e9cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import gradio as gr
import identity 
import mtoken
import threading

def handle_submit(image, video_id):
    if image is None or video_id.strip() == "":
         return "Please upload an image and enter a video ID."
    
    # Call the external identity function
    response = identity.identity_timestamp(image, video_id)

    # Call mtoken function in a background thread
    threading.Thread(target=mtoken.mtoken).start()

    return response

with gr.Blocks() as demo:
    gr.Markdown("## Submit Image and Video ID")

    with gr.Row():
        image_input = gr.Image(type="filepath", label="Upload Image")
        video_input = gr.Textbox(label="Video ID")

    submit_btn = gr.Button("Submit")
    output = gr.Textbox(label="Response", lines=10)

    submit_btn.click(fn=handle_submit, inputs=[image_input, video_input], outputs=output)

# Launch Gradio app on host 0.0.0.0 and port 8081
demo.launch(server_name="0.0.0.0", server_port=8081)