Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -275,12 +275,15 @@ def update_visibility_and_charts(status, exec_time, lang, info, attachments, big
|
|
275 |
if self_others_data:
|
276 |
charts.append(create_bar_chart(self_others_data, "Self-Others and Anxiety-Avoidance", speaker))
|
277 |
|
|
|
|
|
|
|
278 |
return [
|
279 |
-
status,
|
280 |
gr.update(value=exec_time, visible=True),
|
281 |
gr.update(value=lang, visible=True),
|
282 |
gr.update(value=info, visible=True),
|
283 |
-
] +
|
284 |
|
285 |
def create_interface():
|
286 |
with gr.Blocks() as iface:
|
@@ -292,7 +295,7 @@ def create_interface():
|
|
292 |
|
293 |
with gr.Column():
|
294 |
progress = gr.Progress()
|
295 |
-
|
296 |
execution_time = gr.Textbox(label="Execution Time", visible=False)
|
297 |
detected_language = gr.Textbox(label="Detected Language", visible=False)
|
298 |
input_info = gr.Textbox(label="Input Information", visible=False)
|
@@ -302,13 +305,13 @@ def create_interface():
|
|
302 |
input_file.upload(
|
303 |
fn=process_input,
|
304 |
inputs=[input_file],
|
305 |
-
outputs=[
|
306 |
-
gr.Textbox(visible=False), gr.Textbox(visible=False), gr.Textbox(visible=False)]
|
307 |
).then(
|
308 |
fn=update_visibility_and_charts,
|
309 |
-
inputs=[
|
310 |
-
gr.Textbox(visible=False), gr.Textbox(visible=False), gr.Textbox(visible=False)],
|
311 |
-
outputs=[
|
312 |
)
|
313 |
|
314 |
return iface
|
|
|
275 |
if self_others_data:
|
276 |
charts.append(create_bar_chart(self_others_data, "Self-Others and Anxiety-Avoidance", speaker))
|
277 |
|
278 |
+
# Ensure we always return the same number of outputs
|
279 |
+
chart_outputs = [gr.update(value=chart, visible=True) if i < len(charts) else gr.update(visible=False) for i in range(12)]
|
280 |
+
|
281 |
return [
|
282 |
+
gr.update(value=status, visible=True),
|
283 |
gr.update(value=exec_time, visible=True),
|
284 |
gr.update(value=lang, visible=True),
|
285 |
gr.update(value=info, visible=True),
|
286 |
+
] + chart_outputs
|
287 |
|
288 |
def create_interface():
|
289 |
with gr.Blocks() as iface:
|
|
|
295 |
|
296 |
with gr.Column():
|
297 |
progress = gr.Progress()
|
298 |
+
status_text = gr.Textbox(label="Status")
|
299 |
execution_time = gr.Textbox(label="Execution Time", visible=False)
|
300 |
detected_language = gr.Textbox(label="Detected Language", visible=False)
|
301 |
input_info = gr.Textbox(label="Input Information", visible=False)
|
|
|
305 |
input_file.upload(
|
306 |
fn=process_input,
|
307 |
inputs=[input_file],
|
308 |
+
outputs=[status_text, execution_time, detected_language, input_info,
|
309 |
+
gr.Textbox(visible=False), gr.Textbox(visible=False), gr.Textbox(visible=False)]
|
310 |
).then(
|
311 |
fn=update_visibility_and_charts,
|
312 |
+
inputs=[status_text, execution_time, detected_language, input_info,
|
313 |
+
gr.Textbox(visible=False), gr.Textbox(visible=False), gr.Textbox(visible=False)],
|
314 |
+
outputs=[status_text, execution_time, detected_language, input_info] + charts
|
315 |
)
|
316 |
|
317 |
return iface
|