reab5555 commited on
Commit
117dfa6
·
verified ·
1 Parent(s): d97bb05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -25,7 +25,7 @@ def analyze_video(video_path, language_display_name, max_speakers, progress=gr.P
25
  start_time = time.time()
26
 
27
  if not video_path:
28
- return [gr.Markdown("Please upload a video file.")] + [gr.update(visible=False)] * 49 + ["Analysis not started."]
29
 
30
  # Convert the display name to the language code
31
  language = LANGUAGE_MAP[language_display_name]
@@ -65,6 +65,8 @@ def analyze_video(video_path, language_display_name, max_speakers, progress=gr.P
65
 
66
  # Prepare outputs for each speaker
67
  output_components = []
 
 
68
  for speaker_id, speaker_charts in charts.items():
69
  speaker_explanations = explanations[speaker_id]
70
 
@@ -81,6 +83,19 @@ def analyze_video(video_path, language_display_name, max_speakers, progress=gr.P
81
 
82
  output_components.extend(speaker_section)
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  # Add the transcript at the end
85
  output_components.append(gr.Textbox(value=transcription, label="Transcript", lines=10, visible=True))
86
 
@@ -89,6 +104,7 @@ def analyze_video(video_path, language_display_name, max_speakers, progress=gr.P
89
 
90
  return output_components
91
 
 
92
  # Define the Gradio interface
93
  with gr.Blocks() as iface:
94
  gr.Markdown("# AI Personality Detection")
 
25
  start_time = time.time()
26
 
27
  if not video_path:
28
+ return [gr.Markdown("Please upload a video file.")] + [gr.update(visible=False)] * 48 + ["Analysis not started."]
29
 
30
  # Convert the display name to the language code
31
  language = LANGUAGE_MAP[language_display_name]
 
65
 
66
  # Prepare outputs for each speaker
67
  output_components = []
68
+ speaker_count = len(charts)
69
+
70
  for speaker_id, speaker_charts in charts.items():
71
  speaker_explanations = explanations[speaker_id]
72
 
 
83
 
84
  output_components.extend(speaker_section)
85
 
86
+ # Add empty placeholders for remaining outputs if fewer speakers than expected
87
+ while len(output_components) < 48:
88
+ output_components.extend([
89
+ gr.Markdown(visible=False),
90
+ gr.Plot(visible=False),
91
+ gr.Textbox(visible=False),
92
+ gr.Plot(visible=False),
93
+ gr.Plot(visible=False),
94
+ gr.Textbox(visible=False),
95
+ gr.Plot(visible=False),
96
+ gr.Textbox(visible=False),
97
+ ])
98
+
99
  # Add the transcript at the end
100
  output_components.append(gr.Textbox(value=transcription, label="Transcript", lines=10, visible=True))
101
 
 
104
 
105
  return output_components
106
 
107
+
108
  # Define the Gradio interface
109
  with gr.Blocks() as iface:
110
  gr.Markdown("# AI Personality Detection")