Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,9 +3,9 @@ import subprocess
|
|
3 |
import os
|
4 |
|
5 |
def run_inference(audio_file):
|
6 |
-
#
|
7 |
-
|
8 |
-
|
9 |
# Define the command to run your script
|
10 |
command = [
|
11 |
"python", "scripts/demo.py",
|
@@ -14,7 +14,7 @@ def run_inference(audio_file):
|
|
14 |
"--audio_file", audio_file,
|
15 |
"--body_model_name", "s2g_LS3DCG",
|
16 |
"--body_model_path", "experiments/2022-10-19-smplx_S2G-LS3DCG/ckpt-99.pth",
|
17 |
-
"--id", "0"
|
18 |
]
|
19 |
|
20 |
# Run the command and capture the output
|
@@ -24,8 +24,16 @@ def run_inference(audio_file):
|
|
24 |
if result.returncode != 0:
|
25 |
return f"Error: {result.stderr}"
|
26 |
|
27 |
-
#
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
# Create Gradio interface
|
31 |
interface = gr.Interface(
|
|
|
3 |
import os
|
4 |
|
5 |
def run_inference(audio_file):
|
6 |
+
# Extract the audio filename to construct the video filename later
|
7 |
+
audio_filename = os.path.basename(audio_file)
|
8 |
+
|
9 |
# Define the command to run your script
|
10 |
command = [
|
11 |
"python", "scripts/demo.py",
|
|
|
14 |
"--audio_file", audio_file,
|
15 |
"--body_model_name", "s2g_LS3DCG",
|
16 |
"--body_model_path", "experiments/2022-10-19-smplx_S2G-LS3DCG/ckpt-99.pth",
|
17 |
+
"--id", "0"
|
18 |
]
|
19 |
|
20 |
# Run the command and capture the output
|
|
|
24 |
if result.returncode != 0:
|
25 |
return f"Error: {result.stderr}"
|
26 |
|
27 |
+
# Construct the output video filename based on your logic
|
28 |
+
# Assuming config.Log.name is a fixed string or you may need to adjust this accordingly
|
29 |
+
config_log_name = "YourLogName" # Replace with the actual log name used in your config
|
30 |
+
output_video_path = f'visualise/video/{config_log_name}/{audio_filename.rsplit(".", 1)[0]}.mp4'
|
31 |
+
|
32 |
+
# Check if the video file exists and return the path
|
33 |
+
if os.path.exists(output_video_path):
|
34 |
+
return output_video_path
|
35 |
+
else:
|
36 |
+
return "Video file not found."
|
37 |
|
38 |
# Create Gradio interface
|
39 |
interface = gr.Interface(
|