Spaces:
Running
Running
Update simple_app.py
Browse files- simple_app.py +9 -3
simple_app.py
CHANGED
@@ -27,7 +27,7 @@ def infer(prompt, progress=gr.Progress(track_tqdm=True)):
|
|
27 |
# Run the model inference in a subprocess
|
28 |
process = subprocess.Popen(command,
|
29 |
stdout=subprocess.PIPE,
|
30 |
-
stderr=subprocess.PIPE,
|
31 |
text=True,
|
32 |
bufsize=1)
|
33 |
|
@@ -67,16 +67,22 @@ def infer(prompt, progress=gr.Progress(track_tqdm=True)):
|
|
67 |
if process.poll() is not None:
|
68 |
break
|
69 |
|
|
|
|
|
|
|
|
|
|
|
70 |
# Clean up and finalize the progress bar
|
71 |
process.wait()
|
72 |
if video_progress_bar:
|
73 |
video_progress_bar.close()
|
74 |
|
75 |
-
#
|
76 |
if process.returncode == 0:
|
77 |
return "generated_video.mp4"
|
78 |
else:
|
79 |
-
|
|
|
80 |
|
81 |
# Gradio UI
|
82 |
with gr.Blocks() as demo:
|
|
|
27 |
# Run the model inference in a subprocess
|
28 |
process = subprocess.Popen(command,
|
29 |
stdout=subprocess.PIPE,
|
30 |
+
stderr=subprocess.PIPE, # Capture stderr for error messages
|
31 |
text=True,
|
32 |
bufsize=1)
|
33 |
|
|
|
67 |
if process.poll() is not None:
|
68 |
break
|
69 |
|
70 |
+
# Drain any remaining output from stderr
|
71 |
+
stderr_output = process.stderr.read().strip()
|
72 |
+
if stderr_output:
|
73 |
+
print(f"Error output:\n{stderr_output}")
|
74 |
+
|
75 |
# Clean up and finalize the progress bar
|
76 |
process.wait()
|
77 |
if video_progress_bar:
|
78 |
video_progress_bar.close()
|
79 |
|
80 |
+
# Check if the process finished successfully
|
81 |
if process.returncode == 0:
|
82 |
return "generated_video.mp4"
|
83 |
else:
|
84 |
+
print(f"Process failed with return code {process.returncode}")
|
85 |
+
raise Exception(f"Error executing command: {stderr_output}")
|
86 |
|
87 |
# Gradio UI
|
88 |
with gr.Blocks() as demo:
|