Spaces:
Running
Running
import gradio as gr | |
import subprocess | |
import os | |
from datetime import datetime | |
def generate_video(source_image, driven_audio): | |
output_dir = "results" | |
os.makedirs(output_dir, exist_ok=True) | |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") | |
result_path = f"{output_dir}/video_{timestamp}.mp4" | |
cmd = f"python inference.py --driven_audio {driven_audio} --source_image {source_image} --result_dir {output_dir} --enhancer gfpgan --pose_style 45 --still --preprocess full" | |
subprocess.run(cmd, shell=True) | |
return result_path | |
demo = gr.Interface( | |
fn=generate_video, | |
inputs=[ | |
gr.Image(type="filepath", label="Source Image"), | |
gr.Audio(type="filepath", label="Driven Audio") | |
], | |
outputs=gr.Video(label="Generated Video") | |
) | |
demo.launch() | |