Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -83,13 +83,15 @@ with gr.Blocks() as iface:
|
|
83 |
|
84 |
# Create output components
|
85 |
output_components = []
|
86 |
-
|
|
|
87 |
# Add transcript output near the top
|
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),
|
@@ -106,12 +108,25 @@ with gr.Blocks() as iface:
|
|
106 |
# Add execution info component
|
107 |
transcript_output = gr.Textbox(label="Transcript", lines=10, visible=False)
|
108 |
output_components.append(transcript_output)
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
analyze_button.click(
|
111 |
fn=analyze_video,
|
112 |
inputs=[video_input],
|
113 |
-
outputs=output_components,
|
114 |
show_progress=True
|
|
|
|
|
|
|
|
|
115 |
)
|
116 |
|
117 |
use_example_button.click(
|
|
|
83 |
|
84 |
# Create output components
|
85 |
output_components = []
|
86 |
+
tab_visibilities = []
|
87 |
+
|
88 |
# Add transcript output near the top
|
89 |
execution_info_box = gr.Textbox(label="Transcript", value="N/A", lines=1)
|
90 |
output_components.append(execution_info_box)
|
91 |
|
92 |
for i in range(3): # Assuming maximum of 3 speakers
|
93 |
+
with gr.Tab(f"Speaker {i+1}", visible=False) as tab:
|
94 |
+
tab_visibilities.append(tab)
|
95 |
with gr.Row():
|
96 |
output_components.extend([
|
97 |
gr.Markdown(visible=False),
|
|
|
108 |
# Add execution info component
|
109 |
transcript_output = gr.Textbox(label="Transcript", lines=10, visible=False)
|
110 |
output_components.append(transcript_output)
|
111 |
+
|
112 |
+
def update_interface(results):
|
113 |
+
outputs = results[:-3] # All outputs except the last 3 (visible tabs info)
|
114 |
+
visible_tabs = results[-3:] # Last 3 items are visible tabs info
|
115 |
+
|
116 |
+
# Update tab visibility
|
117 |
+
tab_updates = [gr.update(visible=(i in visible_tabs)) for i in range(1, 4)]
|
118 |
+
|
119 |
+
return outputs + tab_updates
|
120 |
+
|
121 |
analyze_button.click(
|
122 |
fn=analyze_video,
|
123 |
inputs=[video_input],
|
124 |
+
outputs=output_components + tab_visibilities,
|
125 |
show_progress=True
|
126 |
+
).then(
|
127 |
+
fn=update_interface,
|
128 |
+
inputs=output_components + tab_visibilities,
|
129 |
+
outputs=output_components + tab_visibilities
|
130 |
)
|
131 |
|
132 |
use_example_button.click(
|