vettorazi commited on
Commit
0632471
1 Parent(s): 1d4cc64

Update app.py

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