Commit
·
9e02de3
1
Parent(s):
045f914
Make plots optional with try-except
Browse files
app.py
CHANGED
|
@@ -365,23 +365,39 @@ with gr.Blocks(theme=theme, css=CUSTOM_CSS) as demo:
|
|
| 365 |
elem_classes=["download-button"],
|
| 366 |
)
|
| 367 |
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
|
| 386 |
if __name__ == "__main__":
|
| 387 |
demo.queue().launch(show_api=False)
|
|
|
|
| 365 |
elem_classes=["download-button"],
|
| 366 |
)
|
| 367 |
|
| 368 |
+
try:
|
| 369 |
+
gr.Markdown("### Left Hand Trajectories", elem_classes=["plots-title"])
|
| 370 |
+
plot_outputs_left = []
|
| 371 |
+
with gr.Column(elem_classes=["plots-wrap"]):
|
| 372 |
+
for row in PLOT_GRID:
|
| 373 |
+
with gr.Row():
|
| 374 |
+
for metric in row:
|
| 375 |
+
try:
|
| 376 |
+
plot_html = build_plot_html(metric, "left")
|
| 377 |
+
plot = gr.HTML(value=plot_html, elem_classes=["plot-html"])
|
| 378 |
+
plot_outputs_left.append(plot)
|
| 379 |
+
except Exception as e:
|
| 380 |
+
print(f"Error creating plot {metric} for left hand: {e}")
|
| 381 |
+
plot = gr.HTML(value="<p>Plot unavailable</p>", elem_classes=["plot-html"])
|
| 382 |
+
plot_outputs_left.append(plot)
|
| 383 |
+
|
| 384 |
+
gr.Markdown("### Right Hand Trajectories", elem_classes=["plots-title"])
|
| 385 |
+
plot_outputs_right = []
|
| 386 |
+
with gr.Column(elem_classes=["plots-wrap"]):
|
| 387 |
+
for row in PLOT_GRID:
|
| 388 |
+
with gr.Row():
|
| 389 |
+
for metric in row:
|
| 390 |
+
try:
|
| 391 |
+
plot_html = build_plot_html(metric, "right")
|
| 392 |
+
plot = gr.HTML(value=plot_html, elem_classes=["plot-html"])
|
| 393 |
+
plot_outputs_right.append(plot)
|
| 394 |
+
except Exception as e:
|
| 395 |
+
print(f"Error creating plot {metric} for right hand: {e}")
|
| 396 |
+
plot = gr.HTML(value="<p>Plot unavailable</p>", elem_classes=["plot-html"])
|
| 397 |
+
plot_outputs_right.append(plot)
|
| 398 |
+
except Exception as e:
|
| 399 |
+
print(f"Error creating plots section: {e}")
|
| 400 |
+
gr.Markdown("### Plots unavailable")
|
| 401 |
|
| 402 |
if __name__ == "__main__":
|
| 403 |
demo.queue().launch(show_api=False)
|