Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# app.py (
|
2 |
|
3 |
import gradio as gr
|
4 |
import uuid
|
@@ -36,18 +36,23 @@ def run_video_generation(task_id: str, topic: str, context: str, model: str):
|
|
36 |
|
37 |
# Sanitize topic name to create a valid directory/file prefix
|
38 |
file_prefix = re.sub(r'[^a-z0-9_]+', '_', topic.lower())
|
39 |
-
|
|
|
40 |
|
41 |
# --- THIS IS THE FIX ---
|
42 |
-
#
|
|
|
43 |
command = [
|
44 |
-
"python", "-u", "generate_video.py",
|
45 |
"--model", model,
|
46 |
"--topic", topic,
|
47 |
"--context", context,
|
48 |
-
"--output_dir",
|
|
|
49 |
]
|
50 |
|
|
|
|
|
51 |
try:
|
52 |
process = subprocess.Popen(
|
53 |
command,
|
@@ -65,7 +70,9 @@ def run_video_generation(task_id: str, topic: str, context: str, model: str):
|
|
65 |
process.wait()
|
66 |
|
67 |
if process.returncode == 0:
|
68 |
-
|
|
|
|
|
69 |
if os.path.exists(final_video_path):
|
70 |
tasks[task_id]['status'] = 'completed'
|
71 |
tasks[task_id]['video_path'] = final_video_path
|
|
|
1 |
+
# app.py (Corrected for pathing and live logging)
|
2 |
|
3 |
import gradio as gr
|
4 |
import uuid
|
|
|
36 |
|
37 |
# Sanitize topic name to create a valid directory/file prefix
|
38 |
file_prefix = re.sub(r'[^a-z0-9_]+', '_', topic.lower())
|
39 |
+
# This is the directory where the script will create its files
|
40 |
+
final_output_dir = os.path.join("output", file_prefix)
|
41 |
|
42 |
# --- THIS IS THE FIX ---
|
43 |
+
# We tell the script to use the general 'output' folder.
|
44 |
+
# The script itself will then create the specific 'file_prefix' subfolder inside it.
|
45 |
command = [
|
46 |
+
"python", "-u", "generate_video.py",
|
47 |
"--model", model,
|
48 |
"--topic", topic,
|
49 |
"--context", context,
|
50 |
+
"--output_dir", "output" # Pass the general directory
|
51 |
+
# Langfuse is disabled by not including the --use_langfuse flag
|
52 |
]
|
53 |
|
54 |
+
print(f"Running command: {' '.join(command)}")
|
55 |
+
|
56 |
try:
|
57 |
process = subprocess.Popen(
|
58 |
command,
|
|
|
70 |
process.wait()
|
71 |
|
72 |
if process.returncode == 0:
|
73 |
+
# Check for the final combined video file in the correct specific directory
|
74 |
+
final_video_path = os.path.join(final_output_dir, f"{file_prefix}_combined.mp4")
|
75 |
+
|
76 |
if os.path.exists(final_video_path):
|
77 |
tasks[task_id]['status'] = 'completed'
|
78 |
tasks[task_id]['video_path'] = final_video_path
|