File size: 830 Bytes
67b8ef2
a1a566e
67b8ef2
a1a566e
 
 
67b8ef2
a1a566e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import subprocess

def greet(name, image):
    # Specify the path to the run.py script
    script_path = "run.py"

    # Specify the paths for the image, video, and output
    image_path = ""
    video_path = "video.mp4"
    output_path = "/path/to/output.mp4"

    # Save the uploaded image
    image.save(image_path)

    # Construct the command to execute the run.py script with the specified arguments
    command = f"python {script_path} -s {image_path} -t {video_path} -o {output_path}"

    # Execute the command using subprocess
    subprocess.run(command, shell=True)

    # Return the output video as a gradio Image object
    return gr.inputs.Image(output_path, type="file"), ""

iface = gr.Interface(fn=greet, inputs=["text", gr.inputs.Image(type="pil")], outputs=["image", "text"])
iface.launch()