reab5555 commited on
Commit
899f0f9
·
verified ·
1 Parent(s): 4f242f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -31
app.py CHANGED
@@ -33,38 +33,33 @@ def analyze_video(video_path, progress=gr.Progress()):
33
 
34
  output_components = [transcription] # transcript
35
 
36
- for i, (speaker_id, speaker_charts) in enumerate(charts.items(), start=1):
37
- print(speaker_id)
38
- speaker_explanations = explanations[speaker_id]
39
- speaker_general_impression = general_impressions[speaker_id]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- with gr.Tab(label=speaker_id, visible=True):
42
- with gr.TabItem(label=f'General Impression'):
43
- speaker_section1 = [
44
- gr.Markdown(f"# {speaker_id}", visible=True),
45
- gr.Textbox(value=speaker_general_impression, label="General Impression",
46
- visible=True)
47
- ]
48
-
49
- with gr.TabItem(label=f'Attachment Styles'):
50
- with gr.Row():
51
- speaker_section2 = [
52
- gr.Plot(value=speaker_charts.get("attachment", None), visible=True),
53
- gr.Plot(value=speaker_charts.get("dimensions", None), visible=True),
54
- gr.Textbox(value=speaker_explanations.get("attachment", ""), label="Attachment Styles Explanation", visible=True)]
55
-
56
- with gr.TabItem(label=f'Big Five Traits'):
57
- speaker_section3 = [
58
- gr.Plot(value=speaker_charts.get("bigfive", None), visible=True),
59
- gr.Textbox(value=speaker_explanations.get("bigfive", ""), label="Big Five Traits Explanation", visible=True)
60
- ]
61
-
62
- with gr.TabItem(label=f'Personalities'):
63
- speaker_section4 = [
64
- gr.Plot(value=speaker_charts.get("personality", None), visible=True),
65
- gr.Textbox(value=speaker_explanations.get("personality", ""), label="Personality Disorders Explanation", visible=True)
66
- ]
67
-
68
  output_components.extend(speaker_section1)
69
  output_components.extend(speaker_section2)
70
  output_components.extend(speaker_section3)
 
33
 
34
  output_components = [transcription] # transcript
35
 
36
+ for i in range(3):
37
+ speaker_id = f"Speaker {i+1}" if i < len(charts) else f"Speaker {i+1} (Not Present)"
38
+ speaker_charts = charts.get(speaker_id, {})
39
+ speaker_explanations = explanations.get(speaker_id, {})
40
+ speaker_general_impression = general_impressions.get(speaker_id, "No data for this speaker")
41
+
42
+ speaker_section1 = [
43
+ gr.Markdown(f"# {speaker_id}", visible=True),
44
+ gr.Textbox(value=speaker_general_impression, label="General Impression", visible=True)
45
+ ]
46
+
47
+ speaker_section2 = [
48
+ gr.Plot(value=speaker_charts.get("attachment", None), visible=True),
49
+ gr.Plot(value=speaker_charts.get("dimensions", None), visible=True),
50
+ gr.Textbox(value=speaker_explanations.get("attachment", ""), label="Attachment Styles Explanation", visible=True)
51
+ ]
52
+
53
+ speaker_section3 = [
54
+ gr.Plot(value=speaker_charts.get("bigfive", None), visible=True),
55
+ gr.Textbox(value=speaker_explanations.get("bigfive", ""), label="Big Five Traits Explanation", visible=True)
56
+ ]
57
+
58
+ speaker_section4 = [
59
+ gr.Plot(value=speaker_charts.get("personality", None), visible=True),
60
+ gr.Textbox(value=speaker_explanations.get("personality", ""), label="Personality Disorders Explanation", visible=True)
61
+ ]
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  output_components.extend(speaker_section1)
64
  output_components.extend(speaker_section2)
65
  output_components.extend(speaker_section3)