Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -98,7 +98,7 @@ def analyze_video(video_path, language_display_name, max_speakers, progress=gr.P
|
|
98 |
start_time = time.time()
|
99 |
|
100 |
if not video_path:
|
101 |
-
return [gr.Markdown("Please upload a video file.")]
|
102 |
|
103 |
# Convert the display name to the language code
|
104 |
language = LANGUAGE_MAP[language_display_name]
|
@@ -151,13 +151,10 @@ def analyze_video(video_path, language_display_name, max_speakers, progress=gr.P
|
|
151 |
label=f"Personality Disorders Explanation - Speaker {speaker_id}", lines=2)
|
152 |
])
|
153 |
|
154 |
-
# Add the transcript
|
155 |
-
output_components.
|
156 |
-
gr.Textbox(value=transcription, label="Transcript", lines=10),
|
157 |
-
gr.Textbox(value=f"Completed in {int(execution_time)} seconds.", label="Execution Information")
|
158 |
-
])
|
159 |
|
160 |
-
return output_components
|
161 |
|
162 |
# Define the Gradio interface
|
163 |
with gr.Blocks() as iface:
|
@@ -170,14 +167,16 @@ with gr.Blocks() as iface:
|
|
170 |
|
171 |
analyze_button = gr.Button("Analyze")
|
172 |
|
173 |
-
# Create a
|
174 |
-
|
175 |
-
|
|
|
|
|
176 |
|
177 |
analyze_button.click(
|
178 |
fn=analyze_video,
|
179 |
inputs=[video_input, language_input, max_speakers],
|
180 |
-
outputs=
|
181 |
show_progress=True
|
182 |
)
|
183 |
|
|
|
98 |
start_time = time.time()
|
99 |
|
100 |
if not video_path:
|
101 |
+
return [gr.Markdown("Please upload a video file.")], "Analysis not started."
|
102 |
|
103 |
# Convert the display name to the language code
|
104 |
language = LANGUAGE_MAP[language_display_name]
|
|
|
151 |
label=f"Personality Disorders Explanation - Speaker {speaker_id}", lines=2)
|
152 |
])
|
153 |
|
154 |
+
# Add the transcript at the end
|
155 |
+
output_components.append(gr.Textbox(value=transcription, label="Transcript", lines=10))
|
|
|
|
|
|
|
156 |
|
157 |
+
return output_components, f"Completed in {int(execution_time)} seconds."
|
158 |
|
159 |
# Define the Gradio interface
|
160 |
with gr.Blocks() as iface:
|
|
|
167 |
|
168 |
analyze_button = gr.Button("Analyze")
|
169 |
|
170 |
+
# Create a container for dynamic outputs
|
171 |
+
output_container = gr.Column()
|
172 |
+
|
173 |
+
# Execution time box
|
174 |
+
execution_info_box = gr.Textbox(label="Execution Information", value="Waiting for analysis...", lines=2)
|
175 |
|
176 |
analyze_button.click(
|
177 |
fn=analyze_video,
|
178 |
inputs=[video_input, language_input, max_speakers],
|
179 |
+
outputs=[output_container, execution_info_box],
|
180 |
show_progress=True
|
181 |
)
|
182 |
|