reab5555 commited on
Commit
fd65dfa
·
verified ·
1 Parent(s): 26a111a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -13
app.py CHANGED
@@ -36,21 +36,28 @@ def analyze_video(video_path, progress=gr.Progress()):
36
  speaker_explanations = explanations[speaker_id]
37
  speaker_general_impression = general_impressions[speaker_id]
38
 
39
- output_components.extend([
40
- f"## {speaker_id}", # speaker header
41
  speaker_general_impression, # speaker impression
42
- speaker_charts["attachment"], # direct Plotly figure
43
- speaker_explanations["attachment"], # attachment explanation
44
- speaker_charts["dimensions"], # direct Plotly figure
45
- speaker_charts["bigfive"], # direct Plotly figure
46
- speaker_explanations["bigfive"], # bigfive explanation
47
- speaker_charts["personality"], # direct Plotly figure
48
- speaker_explanations["personality"], # personality explanation
49
- ])
50
-
 
 
 
 
 
 
 
51
  # Pad with None for any missing speakers
52
  while len(output_components) < 28:
53
- output_components.extend([None] * 9)
54
 
55
  output_components.append(f"Completed in {int(execution_time)} seconds.") # execution info
56
 
@@ -79,7 +86,7 @@ with gr.Blocks() as iface:
79
  with gr.Column() as output_container:
80
  transcript_output = gr.Textbox(label="Transcript", lines=10, visible=False)
81
  speaker_outputs = []
82
- for i in range(1, 4): # Assuming a maximum of 3 speakers
83
  with gr.Column(visible=False) as speaker_column:
84
  speaker_header = gr.Markdown(f"## Speaker {i}")
85
  speaker_impression = gr.Textbox(label="General Impression", lines=3)
 
36
  speaker_explanations = explanations[speaker_id]
37
  speaker_general_impression = general_impressions[speaker_id]
38
 
39
+ speaker_section = [
40
+ gr.Markdown(f"## {speaker_id}", visible=True),
41
  speaker_general_impression, # speaker impression
42
+ gr.Textbox(value=speaker_general_impression.get("general_impression", ""), label="General Impression",
43
+ visible=True),
44
+ gr.Plot(value=speaker_charts.get("attachment", None), visible=True),
45
+ gr.Plot(value=speaker_charts.get("dimensions", None), visible=True),
46
+
47
+ gr.Textbox(value=speaker_explanations.get("attachment", ""), label="Attachment Styles Explanation",
48
+ visible=True),
49
+ gr.Plot(value=speaker_charts.get("bigfive", None), visible=True),
50
+ gr.Textbox(value=speaker_explanations.get("bigfive", ""), label="Big Five Traits Explanation",
51
+ visible=True),
52
+ gr.Plot(value=speaker_charts.get("personality", None), visible=True),
53
+ gr.Textbox(value=speaker_explanations.get("personality", ""), label="Personality Disorders Explanation",
54
+ visible=True),
55
+ ]
56
+ output_components.extend(speaker_section)
57
+
58
  # Pad with None for any missing speakers
59
  while len(output_components) < 28:
60
+ output_components.extend([gr.update(visible=False)] * 9)
61
 
62
  output_components.append(f"Completed in {int(execution_time)} seconds.") # execution info
63
 
 
86
  with gr.Column() as output_container:
87
  transcript_output = gr.Textbox(label="Transcript", lines=10, visible=False)
88
  speaker_outputs = []
89
+ for i in range(1, 4):
90
  with gr.Column(visible=False) as speaker_column:
91
  speaker_header = gr.Markdown(f"## Speaker {i}")
92
  speaker_impression = gr.Textbox(label="General Impression", lines=3)