reab5555 commited on
Commit
00414cc
·
verified ·
1 Parent(s): 70ae5c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -13
app.py CHANGED
@@ -137,19 +137,36 @@ def analyze_video(video_path, language_display_name, max_speakers, progress=gr.P
137
  for speaker_id, speaker_charts in charts.items():
138
  speaker_explanations = explanations[speaker_id]
139
 
140
- output_components.extend([
141
- gr.Markdown(f"### Speaker {speaker_id}"),
142
- gr.Plot(speaker_charts["attachment"]),
143
- gr.Textbox(value=speaker_explanations["attachment"],
144
- label=f"Attachment Styles Explanation - Speaker {speaker_id}", lines=2),
145
- gr.Plot(speaker_charts["dimensions"]),
146
- gr.Plot(speaker_charts["bigfive"]),
147
- gr.Textbox(value=speaker_explanations["bigfive"],
148
- label=f"Big Five Traits Explanation - Speaker {speaker_id}", lines=2),
149
- gr.Plot(speaker_charts["personality"]),
150
- gr.Textbox(value=speaker_explanations["personality"],
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))
 
137
  for speaker_id, speaker_charts in charts.items():
138
  speaker_explanations = explanations[speaker_id]
139
 
140
+ # Prepare outputs for each speaker
141
+ output_components = []
142
+ for speaker_id, speaker_charts in charts.items():
143
+ speaker_explanations = explanations[speaker_id]
144
+
145
+ output_components.append(gr.Markdown(f"### {speaker_id}"))
146
+
147
+ if "attachment" in speaker_charts:
148
+ output_components.extend([
149
+ gr.Plot(speaker_charts["attachment"]),
150
+ gr.Textbox(value=speaker_explanations.get("attachment", ""),
151
+ label=f"Attachment Styles Explanation - {speaker_id}", lines=2),
152
+ ])
153
+
154
+ if "dimensions" in speaker_charts:
155
+ output_components.append(gr.Plot(speaker_charts["dimensions"]))
156
+
157
+ if "bigfive" in speaker_charts:
158
+ output_components.extend([
159
+ gr.Plot(speaker_charts["bigfive"]),
160
+ gr.Textbox(value=speaker_explanations.get("bigfive", ""),
161
+ label=f"Big Five Traits Explanation - {speaker_id}", lines=2),
162
+ ])
163
+
164
+ if "personality" in speaker_charts:
165
+ output_components.extend([
166
+ gr.Plot(speaker_charts["personality"]),
167
+ gr.Textbox(value=speaker_explanations.get("personality", ""),
168
+ label=f"Personality Disorders Explanation - {speaker_id}", lines=2),
169
+ ])
170
 
171
  # Add the transcript at the end
172
  output_components.append(gr.Textbox(value=transcription, label="Transcript", lines=10))