Update app.py
Browse files
app.py
CHANGED
@@ -92,23 +92,23 @@ def generate_journal_with_images(video_path, frame_interval=30):
|
|
92 |
|
93 |
return journal_entries
|
94 |
|
95 |
-
|
96 |
def display_journal_with_images(video):
|
97 |
-
|
98 |
-
|
99 |
-
# Create the final display with text and images
|
100 |
-
display_items = []
|
101 |
-
for entry, image_path in journal_with_images:
|
102 |
-
display_items.append((entry, image_path)) # Add both the journal entry and the image path
|
103 |
|
104 |
-
|
105 |
-
|
|
|
106 |
|
|
|
107 |
with gr.Blocks() as iface:
|
108 |
-
video_input = gr.Video(label="Upload Video", height=300)
|
109 |
-
|
|
|
110 |
run_button = gr.Button("Generate Journal")
|
111 |
|
112 |
-
run_button.click(fn=display_journal_with_images, inputs=video_input, outputs=
|
|
|
|
|
113 |
|
114 |
iface.launch()
|
|
|
92 |
|
93 |
return journal_entries
|
94 |
|
95 |
+
|
96 |
def display_journal_with_images(video):
|
97 |
+
journal_entries, image_paths = generate_journal_with_images(video, frame_interval=30)
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
+
# Return journal text and list of images separately
|
100 |
+
journal_text = "\n".join(journal_entries)
|
101 |
+
return journal_text, image_paths
|
102 |
|
103 |
+
# Define Gradio Blocks for custom display
|
104 |
with gr.Blocks() as iface:
|
105 |
+
video_input = gr.Video(label="Upload Video", height=300)
|
106 |
+
journal_output = gr.Textbox(label="Generated Daily Journal", lines=10)
|
107 |
+
image_gallery = gr.Gallery(label="Annotated Frames").style(grid=[2], height="auto")
|
108 |
run_button = gr.Button("Generate Journal")
|
109 |
|
110 |
+
run_button.click(fn=display_journal_with_images, inputs=video_input, outputs=[journal_output, image_gallery])
|
111 |
+
|
112 |
+
iface.launch()
|
113 |
|
114 |
iface.launch()
|