add example gallery showing video
Browse files
app.py
CHANGED
|
@@ -534,7 +534,9 @@ def mcp_agent_pipeline(niche, style, num_variations=1):
|
|
| 534 |
status_log.append(f" β³ Creating {len(video_results)} video variations...")
|
| 535 |
|
| 536 |
output_dir = "/tmp/quote_videos"
|
|
|
|
| 537 |
os.makedirs(output_dir, exist_ok=True)
|
|
|
|
| 538 |
|
| 539 |
created_videos = []
|
| 540 |
import time
|
|
@@ -554,6 +556,15 @@ def mcp_agent_pipeline(niche, style, num_variations=1):
|
|
| 554 |
if creation_result["success"]:
|
| 555 |
created_videos.append(creation_result["output_path"])
|
| 556 |
status_log.append(f" β
Variation {i+1} created!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 557 |
else:
|
| 558 |
error_msg = creation_result.get("message", "Unknown error")
|
| 559 |
status_log.append(f" β οΈ Variation {i+1} failed: {error_msg}")
|
|
@@ -614,7 +625,9 @@ def fallback_pipeline(niche, style, num_variations=1):
|
|
| 614 |
# Create videos
|
| 615 |
status_log.append("π¬ Creating videos...")
|
| 616 |
output_dir = "/tmp/quote_videos"
|
|
|
|
| 617 |
os.makedirs(output_dir, exist_ok=True)
|
|
|
|
| 618 |
|
| 619 |
import time
|
| 620 |
timestamp = int(time.time())
|
|
@@ -633,6 +646,15 @@ def fallback_pipeline(niche, style, num_variations=1):
|
|
| 633 |
|
| 634 |
if creation_result["success"]:
|
| 635 |
created_videos.append(creation_result["output_path"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 636 |
else:
|
| 637 |
error_msg = creation_result.get("message", "Unknown error")
|
| 638 |
status_log.append(f" β Video {i+1} error: {error_msg}")
|
|
@@ -660,6 +682,38 @@ with gr.Blocks(title="AIQuoteClipGenerator - MCP Edition", theme=gr.themes.Soft(
|
|
| 660 |
- π¨ **Multiple Variations:** Get different video styles
|
| 661 |
""")
|
| 662 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 663 |
with gr.Row():
|
| 664 |
with gr.Column():
|
| 665 |
gr.Markdown("### π― Input")
|
|
@@ -751,4 +805,3 @@ with gr.Blocks(title="AIQuoteClipGenerator - MCP Edition", theme=gr.themes.Soft(
|
|
| 751 |
|
| 752 |
if __name__ == "__main__":
|
| 753 |
demo.launch()
|
| 754 |
-
|
|
|
|
| 534 |
status_log.append(f" β³ Creating {len(video_results)} video variations...")
|
| 535 |
|
| 536 |
output_dir = "/tmp/quote_videos"
|
| 537 |
+
gallery_dir = "/tmp/gallery_videos"
|
| 538 |
os.makedirs(output_dir, exist_ok=True)
|
| 539 |
+
os.makedirs(gallery_dir, exist_ok=True)
|
| 540 |
|
| 541 |
created_videos = []
|
| 542 |
import time
|
|
|
|
| 556 |
if creation_result["success"]:
|
| 557 |
created_videos.append(creation_result["output_path"])
|
| 558 |
status_log.append(f" β
Variation {i+1} created!")
|
| 559 |
+
|
| 560 |
+
# Copy to gallery for public viewing
|
| 561 |
+
import shutil
|
| 562 |
+
gallery_filename = f"gallery_{timestamp}_v{i+1}.mp4"
|
| 563 |
+
gallery_path = os.path.join(gallery_dir, gallery_filename)
|
| 564 |
+
try:
|
| 565 |
+
shutil.copy2(creation_result["output_path"], gallery_path)
|
| 566 |
+
except:
|
| 567 |
+
pass # Silently fail if can't copy to gallery
|
| 568 |
else:
|
| 569 |
error_msg = creation_result.get("message", "Unknown error")
|
| 570 |
status_log.append(f" β οΈ Variation {i+1} failed: {error_msg}")
|
|
|
|
| 625 |
# Create videos
|
| 626 |
status_log.append("π¬ Creating videos...")
|
| 627 |
output_dir = "/tmp/quote_videos"
|
| 628 |
+
gallery_dir = "/tmp/gallery_videos"
|
| 629 |
os.makedirs(output_dir, exist_ok=True)
|
| 630 |
+
os.makedirs(gallery_dir, exist_ok=True)
|
| 631 |
|
| 632 |
import time
|
| 633 |
timestamp = int(time.time())
|
|
|
|
| 646 |
|
| 647 |
if creation_result["success"]:
|
| 648 |
created_videos.append(creation_result["output_path"])
|
| 649 |
+
|
| 650 |
+
# Copy to gallery
|
| 651 |
+
import shutil
|
| 652 |
+
gallery_filename = f"gallery_{timestamp}_v{i+1}.mp4"
|
| 653 |
+
gallery_path = os.path.join(gallery_dir, gallery_filename)
|
| 654 |
+
try:
|
| 655 |
+
shutil.copy2(creation_result["output_path"], gallery_path)
|
| 656 |
+
except:
|
| 657 |
+
pass
|
| 658 |
else:
|
| 659 |
error_msg = creation_result.get("message", "Unknown error")
|
| 660 |
status_log.append(f" β Video {i+1} error: {error_msg}")
|
|
|
|
| 682 |
- π¨ **Multiple Variations:** Get different video styles
|
| 683 |
""")
|
| 684 |
|
| 685 |
+
# Example Gallery
|
| 686 |
+
with gr.Accordion("πΈ Example Gallery - Recent Videos", open=True):
|
| 687 |
+
gr.Markdown("See what others have created! These update in real-time.")
|
| 688 |
+
|
| 689 |
+
gallery_videos = []
|
| 690 |
+
gallery_output_dir = "/tmp/gallery_videos"
|
| 691 |
+
|
| 692 |
+
# Check if there are any existing videos in gallery
|
| 693 |
+
if os.path.exists(gallery_output_dir):
|
| 694 |
+
import glob
|
| 695 |
+
existing_videos = sorted(glob.glob(f"{gallery_output_dir}/*.mp4"),
|
| 696 |
+
key=os.path.getmtime, reverse=True)[:6] # Show 6 most recent
|
| 697 |
+
gallery_videos = existing_videos
|
| 698 |
+
|
| 699 |
+
if gallery_videos:
|
| 700 |
+
with gr.Row():
|
| 701 |
+
for video_path in gallery_videos[:3]:
|
| 702 |
+
gr.Video(value=video_path, label="", height=300, show_label=False)
|
| 703 |
+
if len(gallery_videos) > 3:
|
| 704 |
+
with gr.Row():
|
| 705 |
+
for video_path in gallery_videos[3:6]:
|
| 706 |
+
gr.Video(value=video_path, label="", height=300, show_label=False)
|
| 707 |
+
else:
|
| 708 |
+
gr.Markdown("""
|
| 709 |
+
π¬ **No examples yet!** Be the first to generate a video!
|
| 710 |
+
|
| 711 |
+
Your generated videos will appear here for others to see.
|
| 712 |
+
""")
|
| 713 |
+
|
| 714 |
+
gr.Markdown("---")
|
| 715 |
+
gr.Markdown("## π― Generate Your Own Quote Video")
|
| 716 |
+
|
| 717 |
with gr.Row():
|
| 718 |
with gr.Column():
|
| 719 |
gr.Markdown("### π― Input")
|
|
|
|
| 805 |
|
| 806 |
if __name__ == "__main__":
|
| 807 |
demo.launch()
|
|
|