deepfake / app.py
vettorazi's picture
Update app.py
a1a566e
raw
history blame
830 Bytes
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()