vettorazi commited on
Commit
a1a566e
1 Parent(s): 07c23d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -4
app.py CHANGED
@@ -1,7 +1,26 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import subprocess
3
 
4
+ def greet(name, image):
5
+ # Specify the path to the run.py script
6
+ script_path = "run.py"
7
 
8
+ # Specify the paths for the image, video, and output
9
+ image_path = ""
10
+ video_path = "video.mp4"
11
+ output_path = "/path/to/output.mp4"
12
+
13
+ # Save the uploaded image
14
+ image.save(image_path)
15
+
16
+ # Construct the command to execute the run.py script with the specified arguments
17
+ command = f"python {script_path} -s {image_path} -t {video_path} -o {output_path}"
18
+
19
+ # Execute the command using subprocess
20
+ subprocess.run(command, shell=True)
21
+
22
+ # Return the output video as a gradio Image object
23
+ return gr.inputs.Image(output_path, type="file"), ""
24
+
25
+ iface = gr.Interface(fn=greet, inputs=["text", gr.inputs.Image(type="pil")], outputs=["image", "text"])
26
+ iface.launch()