reab5555 commited on
Commit
3ed67f0
·
verified ·
1 Parent(s): 05fb50d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -25
app.py CHANGED
@@ -53,12 +53,6 @@ def analyze_video(video_path, progress=gr.Progress()):
53
  visible=True),
54
  ]
55
  output_components.extend(speaker_section)
56
- output_components.append(gr.update(visible=True))
57
-
58
- # Hide unused tabs
59
- for j in range(i, 3):
60
- output_components.extend([gr.update(visible=False)] * 9) # Hide components
61
- output_components.append(gr.update(visible=False)) # Hide the tab
62
 
63
  # Pad with None for any missing speakers
64
  while len(output_components) < 28:
@@ -94,23 +88,20 @@ with gr.Blocks() as iface:
94
  execution_info_box = gr.Textbox(label="Transcript", value="N/A", lines=1)
95
  output_components.append(execution_info_box)
96
 
97
- # In the interface definition
98
- speaker_tabs = []
99
- for i in range(3):
100
- with gr.Tab(f"Speaker {i+1}", visible=False) as tab:
101
- speaker_tabs.append(tab)
102
  with gr.Row():
103
  output_components.extend([
104
- gr.Markdown(visible=False),
105
- gr.Textbox(label="General Impression", visible=False),
106
- gr.Plot(visible=False),
107
- gr.Plot(visible=False),
108
- gr.Textbox(label="Attachment Styles Explanation", visible=False),
109
- gr.Plot(visible=False),
110
- gr.Textbox(label="Big Five Traits Explanation", visible=False),
111
- gr.Plot(visible=False),
112
- gr.Textbox(label="Personality Disorders Explanation", visible=False),
113
- ])
114
 
115
  # Add execution info component
116
  transcript_output = gr.Textbox(label="Transcript", lines=10, visible=False)
@@ -119,7 +110,7 @@ with gr.Blocks() as iface:
119
  analyze_button.click(
120
  fn=analyze_video,
121
  inputs=[video_input],
122
- outputs=output_components + speaker_tabs, # Add speaker_tabs to the outputs
123
  show_progress=True
124
  )
125
 
@@ -128,9 +119,9 @@ with gr.Blocks() as iface:
128
  inputs=[],
129
  outputs=[video_input],
130
  ).then(fn=analyze_video,
131
- inputs=[video_input],
132
- outputs=output_components + speaker_tabs, # Add speaker_tabs to the outputs
133
- show_progress=True
134
  )
135
 
136
  if __name__ == "__main__":
 
53
  visible=True),
54
  ]
55
  output_components.extend(speaker_section)
 
 
 
 
 
 
56
 
57
  # Pad with None for any missing speakers
58
  while len(output_components) < 28:
 
88
  execution_info_box = gr.Textbox(label="Transcript", value="N/A", lines=1)
89
  output_components.append(execution_info_box)
90
 
91
+ for i in range(3): # Assuming maximum of 3 speakers
92
+ with gr.Tab(f"Speaker {i+1}"):
 
 
 
93
  with gr.Row():
94
  output_components.extend([
95
+ gr.Markdown(visible=False),
96
+ gr.Textbox(label="General Impression", visible=False),
97
+ gr.Plot(visible=False),
98
+ gr.Plot(visible=False),
99
+ gr.Textbox(label="Attachment Styles Explanation", visible=False),
100
+ gr.Plot(visible=False),
101
+ gr.Textbox(label="Big Five Traits Explanation", visible=False),
102
+ gr.Plot(visible=False),
103
+ gr.Textbox(label="Personality Disorders Explanation", visible=False),
104
+ ])
105
 
106
  # Add execution info component
107
  transcript_output = gr.Textbox(label="Transcript", lines=10, visible=False)
 
110
  analyze_button.click(
111
  fn=analyze_video,
112
  inputs=[video_input],
113
+ outputs=output_components,
114
  show_progress=True
115
  )
116
 
 
119
  inputs=[],
120
  outputs=[video_input],
121
  ).then(fn=analyze_video,
122
+ inputs=[video_input],
123
+ outputs=output_components,
124
+ show_progress=True
125
  )
126
 
127
  if __name__ == "__main__":