Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -456,12 +456,20 @@ class CartoonFilmGenerator:
|
|
| 456 |
final_video = self.merge_videos_with_ffmpeg(scene_videos, audio_path)
|
| 457 |
|
| 458 |
if final_video and os.path.exists(final_video):
|
| 459 |
-
return final_video,
|
| 460 |
else:
|
| 461 |
-
return None,
|
| 462 |
|
| 463 |
except Exception as e:
|
| 464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
|
| 466 |
# Initialize generator
|
| 467 |
generator = CartoonFilmGenerator()
|
|
@@ -470,7 +478,14 @@ generator = CartoonFilmGenerator()
|
|
| 470 |
def create_cartoon_film(script, include_audio):
|
| 471 |
"""Gradio interface function"""
|
| 472 |
if not script.strip():
|
| 473 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
|
| 475 |
return generator.generate_cartoon_film(script, include_audio)
|
| 476 |
|
|
@@ -577,4 +592,4 @@ with gr.Blocks(
|
|
| 577 |
""")
|
| 578 |
|
| 579 |
if __name__ == "__main__":
|
| 580 |
-
demo.queue(max_size=3).launch()
|
|
|
|
| 456 |
final_video = self.merge_videos_with_ffmpeg(scene_videos, audio_path)
|
| 457 |
|
| 458 |
if final_video and os.path.exists(final_video):
|
| 459 |
+
return final_video, processed_script, "β
Cartoon film generated successfully!"
|
| 460 |
else:
|
| 461 |
+
return None, processed_script, "β Error in final video generation"
|
| 462 |
|
| 463 |
except Exception as e:
|
| 464 |
+
# Return error information in proper JSON format
|
| 465 |
+
error_info = {
|
| 466 |
+
"error": True,
|
| 467 |
+
"message": str(e),
|
| 468 |
+
"characters": [],
|
| 469 |
+
"scenes": [],
|
| 470 |
+
"style": "Error occurred during generation"
|
| 471 |
+
}
|
| 472 |
+
return None, error_info, f"β Generation failed: {str(e)}"
|
| 473 |
|
| 474 |
# Initialize generator
|
| 475 |
generator = CartoonFilmGenerator()
|
|
|
|
| 478 |
def create_cartoon_film(script, include_audio):
|
| 479 |
"""Gradio interface function"""
|
| 480 |
if not script.strip():
|
| 481 |
+
empty_response = {
|
| 482 |
+
"error": True,
|
| 483 |
+
"message": "No script provided",
|
| 484 |
+
"characters": [],
|
| 485 |
+
"scenes": [],
|
| 486 |
+
"style": "Please enter a script"
|
| 487 |
+
}
|
| 488 |
+
return None, empty_response, "β Please enter a script"
|
| 489 |
|
| 490 |
return generator.generate_cartoon_film(script, include_audio)
|
| 491 |
|
|
|
|
| 592 |
""")
|
| 593 |
|
| 594 |
if __name__ == "__main__":
|
| 595 |
+
demo.queue(max_size=3).launch()
|