reab5555 commited on
Commit
7aada44
·
verified ·
1 Parent(s): ffeeaec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -24
app.py CHANGED
@@ -49,11 +49,10 @@ def analyze_video(video_path, progress=gr.Progress()):
49
  with gr.TabItem(label=f'Attachment Styles'):
50
  with gr.Row():
51
  speaker_section2_1 = [
52
- gr.Plot(value=speaker_charts.get("attachment", None), visible=True)],
53
- speaker_section2_2 = [
54
  gr.Plot(value=speaker_charts.get("dimensions", None), visible=True)]
55
  with gr.Row():
56
- speaker_section2_3 = [
57
  gr.Textbox(value=speaker_explanations.get("attachment", ""), label="Attachment Styles Explanation", visible=True)]
58
 
59
  with gr.TabItem(label=f'Big Five Traits'):
@@ -71,7 +70,6 @@ def analyze_video(video_path, progress=gr.Progress()):
71
  output_components.extend(speaker_section1)
72
  output_components.extend(speaker_section2_1)
73
  output_components.extend(speaker_section2_2)
74
- output_components.extend(speaker_section2_3)
75
  output_components.extend(speaker_section3)
76
  output_components.extend(speaker_section4)
77
 
@@ -101,38 +99,49 @@ with gr.Blocks() as iface:
101
  gr.Markdown("Example Video")
102
  example_video = gr.Video("examples/Scenes.From.A.Marriage.US.mp4", label="Example Video")
103
  use_example_button = gr.Button("Use Example Video")
104
-
105
  # Create output components
106
  output_components = []
107
 
108
  # Add transcript output near the top
109
- transcript_output = gr.Textbox(label="Transcript", value="N/A", lines=10)
110
- output_components.append(transcript_output)
111
 
112
  for i in range(3): # Assuming maximum of 3 speakers
113
  with gr.Tab(label=f'Speaker {i+1}', visible=False):
114
- with gr.TabItem(label=f'General Impression'):
115
- output_components.append(gr.Markdown(visible=False))
116
- output_components.append(gr.Textbox(label="General Impression", visible=False))
117
-
 
118
  with gr.TabItem(label=f'Attachment Styles'):
119
  with gr.Row():
120
- output_components.append(gr.Plot(visible=False))
121
- output_components.append(gr.Plot(visible=False))
122
- output_components.append(gr.Textbox(label="Attachment Styles Explanation", visible=False))
123
-
 
 
124
  with gr.TabItem(label=f'Big Five Traits'):
125
- output_components.append(gr.Plot(visible=False))
126
- output_components.append(gr.Textbox(label="Big Five Traits Explanation", visible=False))
127
-
 
128
  with gr.TabItem(label=f'Personalities'):
129
- output_components.append(gr.Plot(visible=False))
130
- output_components.append(gr.Textbox(label="Personality Disorders Explanation", visible=False))
131
-
 
 
 
 
 
 
 
132
  # Add execution info component
133
- execution_info_box = gr.Textbox(label="Execution Info", lines=1, visible=False)
134
- output_components.append(execution_info_box)
135
-
136
  analyze_button.click(
137
  fn=analyze_video,
138
  inputs=[video_input],
 
49
  with gr.TabItem(label=f'Attachment Styles'):
50
  with gr.Row():
51
  speaker_section2_1 = [
52
+ gr.Plot(value=speaker_charts.get("attachment", None), visible=True),
 
53
  gr.Plot(value=speaker_charts.get("dimensions", None), visible=True)]
54
  with gr.Row():
55
+ speaker_section2_2 = [
56
  gr.Textbox(value=speaker_explanations.get("attachment", ""), label="Attachment Styles Explanation", visible=True)]
57
 
58
  with gr.TabItem(label=f'Big Five Traits'):
 
70
  output_components.extend(speaker_section1)
71
  output_components.extend(speaker_section2_1)
72
  output_components.extend(speaker_section2_2)
 
73
  output_components.extend(speaker_section3)
74
  output_components.extend(speaker_section4)
75
 
 
99
  gr.Markdown("Example Video")
100
  example_video = gr.Video("examples/Scenes.From.A.Marriage.US.mp4", label="Example Video")
101
  use_example_button = gr.Button("Use Example Video")
102
+
103
  # Create output components
104
  output_components = []
105
 
106
  # Add transcript output near the top
107
+ execution_info_box = gr.Textbox(label="Transcript", value="N/A", lines=1)
108
+ output_components.append(execution_info_box)
109
 
110
  for i in range(3): # Assuming maximum of 3 speakers
111
  with gr.Tab(label=f'Speaker {i+1}', visible=False):
112
+ with gr.TabItem(label=f'General Impression'):
113
+ column_components1 = [
114
+ gr.Markdown(visible=False),
115
+ gr.Textbox(label="General Impression", visible=False)]
116
+
117
  with gr.TabItem(label=f'Attachment Styles'):
118
  with gr.Row():
119
+ column_components2_1 = [
120
+ gr.Plot(visible=False)
121
+ gr.Plot(visible=False)]
122
+ column_components2_2 = [
123
+ gr.Textbox(label="Attachment Styles Explanation", visible=False)]
124
+
125
  with gr.TabItem(label=f'Big Five Traits'):
126
+ column_components3 = [
127
+ gr.Plot(visible=False),
128
+ gr.Textbox(label="Big Five Traits Explanation", visible=False)]
129
+
130
  with gr.TabItem(label=f'Personalities'):
131
+ column_components4 = [
132
+ gr.Plot(visible=False),
133
+ gr.Textbox(label="Personality Disorders Explanation", visible=False)]
134
+
135
+ output_components.extend(column_components1)
136
+ output_components.extend(column_components2_1)
137
+ output_components.extend(column_components2_2)
138
+ output_components.extend(column_components3)
139
+ output_components.extend(column_components4)
140
+
141
  # Add execution info component
142
+ transcript_output = gr.Textbox(label="Transcript", lines=10, visible=False)
143
+ output_components.append(transcript_output)
144
+
145
  analyze_button.click(
146
  fn=analyze_video,
147
  inputs=[video_input],