grid
Browse files
app.py
CHANGED
|
@@ -682,21 +682,21 @@ with gr.Blocks(title="AIQuoteClipGenerator - MCP Edition", theme=gr.themes.Soft(
|
|
| 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! Updates automatically after generation.")
|
| 688 |
|
| 689 |
-
#
|
| 690 |
-
|
| 691 |
-
label="
|
| 692 |
-
show_label=False,
|
| 693 |
-
|
| 694 |
-
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
|
| 701 |
# Function to load gallery videos
|
| 702 |
def load_gallery_videos():
|
|
@@ -707,7 +707,13 @@ with gr.Blocks(title="AIQuoteClipGenerator - MCP Edition", theme=gr.themes.Soft(
|
|
| 707 |
existing_videos = sorted(glob.glob(f"{gallery_output_dir}/*.mp4"),
|
| 708 |
key=os.path.getmtime, reverse=True)[:6]
|
| 709 |
|
| 710 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 711 |
|
| 712 |
gr.Markdown("---")
|
| 713 |
gr.Markdown("## 🎯 Generate Your Own Quote Video")
|
|
@@ -793,21 +799,28 @@ with gr.Blocks(title="AIQuoteClipGenerator - MCP Edition", theme=gr.themes.Soft(
|
|
| 793 |
v2 = videos[1] if len(videos) > 1 else None
|
| 794 |
v3 = videos[2] if len(videos) > 2 else None
|
| 795 |
|
| 796 |
-
# Load updated gallery
|
| 797 |
-
|
| 798 |
|
| 799 |
-
return status, v1, v2, v3
|
| 800 |
|
| 801 |
generate_btn.click(
|
| 802 |
process_and_display,
|
| 803 |
inputs=[niche, style, num_variations],
|
| 804 |
-
outputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
| 805 |
)
|
| 806 |
|
| 807 |
# Load gallery on page load
|
| 808 |
demo.load(
|
| 809 |
load_gallery_videos,
|
| 810 |
-
outputs=[
|
|
|
|
|
|
|
|
|
|
| 811 |
)
|
| 812 |
|
| 813 |
if __name__ == "__main__":
|
|
|
|
| 682 |
- 🎨 **Multiple Variations:** Get different video styles
|
| 683 |
""")
|
| 684 |
|
| 685 |
+
# Example Gallery - Instagram-style grid
|
| 686 |
with gr.Accordion("📸 Example Gallery - Recent Videos", open=True):
|
| 687 |
gr.Markdown("See what others have created! Updates automatically after generation.")
|
| 688 |
|
| 689 |
+
# First row - 3 videos
|
| 690 |
+
with gr.Row():
|
| 691 |
+
gallery_video1 = gr.Video(label="", height=300, show_label=False, interactive=False)
|
| 692 |
+
gallery_video2 = gr.Video(label="", height=300, show_label=False, interactive=False)
|
| 693 |
+
gallery_video3 = gr.Video(label="", height=300, show_label=False, interactive=False)
|
| 694 |
+
|
| 695 |
+
# Second row - 3 videos
|
| 696 |
+
with gr.Row():
|
| 697 |
+
gallery_video4 = gr.Video(label="", height=300, show_label=False, interactive=False)
|
| 698 |
+
gallery_video5 = gr.Video(label="", height=300, show_label=False, interactive=False)
|
| 699 |
+
gallery_video6 = gr.Video(label="", height=300, show_label=False, interactive=False)
|
| 700 |
|
| 701 |
# Function to load gallery videos
|
| 702 |
def load_gallery_videos():
|
|
|
|
| 707 |
existing_videos = sorted(glob.glob(f"{gallery_output_dir}/*.mp4"),
|
| 708 |
key=os.path.getmtime, reverse=True)[:6]
|
| 709 |
|
| 710 |
+
# Return 6 videos (None for empty slots)
|
| 711 |
+
videos = [None] * 6
|
| 712 |
+
for i, video_path in enumerate(existing_videos):
|
| 713 |
+
if i < 6:
|
| 714 |
+
videos[i] = video_path
|
| 715 |
+
|
| 716 |
+
return videos
|
| 717 |
|
| 718 |
gr.Markdown("---")
|
| 719 |
gr.Markdown("## 🎯 Generate Your Own Quote Video")
|
|
|
|
| 799 |
v2 = videos[1] if len(videos) > 1 else None
|
| 800 |
v3 = videos[2] if len(videos) > 2 else None
|
| 801 |
|
| 802 |
+
# Load updated gallery (6 videos)
|
| 803 |
+
gallery_vids = load_gallery_videos()
|
| 804 |
|
| 805 |
+
return [status, v1, v2, v3] + gallery_vids
|
| 806 |
|
| 807 |
generate_btn.click(
|
| 808 |
process_and_display,
|
| 809 |
inputs=[niche, style, num_variations],
|
| 810 |
+
outputs=[
|
| 811 |
+
output, video1, video2, video3,
|
| 812 |
+
gallery_video1, gallery_video2, gallery_video3,
|
| 813 |
+
gallery_video4, gallery_video5, gallery_video6
|
| 814 |
+
]
|
| 815 |
)
|
| 816 |
|
| 817 |
# Load gallery on page load
|
| 818 |
demo.load(
|
| 819 |
load_gallery_videos,
|
| 820 |
+
outputs=[
|
| 821 |
+
gallery_video1, gallery_video2, gallery_video3,
|
| 822 |
+
gallery_video4, gallery_video5, gallery_video6
|
| 823 |
+
]
|
| 824 |
)
|
| 825 |
|
| 826 |
if __name__ == "__main__":
|