Spaces:
Sleeping
Sleeping
File size: 1,264 Bytes
d26f817 a40e0c1 d26f817 195b61e d26f817 195b61e d26f817 |
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
import gradio as gr
import subprocess
import os
def run_inference(audio_file):
# Define the output video filename
output_video = "output_video.mp4" # Change this to your desired output filename
# Define the command to run your script
command = [
"python", "scripts/demo.py",
"--config_file", "./config/LS3DCG.json",
"--infer",
"--audio_file", audio_file,
"--body_model_name", "s2g_LS3DCG",
"--body_model_path", "experiments/2022-10-19-smplx_S2G-LS3DCG/ckpt-99.pth",
"--id", "0",
"--output_video", output_video # Ensure demo.py saves to this filename
]
# Run the command and capture the output
result = subprocess.run(command, capture_output=True, text=True)
# Check for errors
if result.returncode != 0:
return f"Error: {result.stderr}"
# Return the generated video file path
return output_video
# Create Gradio interface
interface = gr.Interface(
fn=run_inference,
inputs=gr.Audio(source="upload", type="filepath"),
outputs=gr.Video(type="file"),
title="Audio to Video Inference",
description="Upload an audio file to generate a video."
)
# Launch the app
if __name__ == "__main__":
interface.launch()
|