reab5555 commited on
Commit
a7e76f3
·
verified ·
1 Parent(s): 41f0694

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
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 and execution info at the end
155
- output_components.extend([
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 group for dynamic outputs
174
- with gr.Group() as output_group:
175
- output_components = []
 
 
176
 
177
  analyze_button.click(
178
  fn=analyze_video,
179
  inputs=[video_input, language_input, max_speakers],
180
- outputs=output_group,
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