Spaces:
Sleeping
Sleeping
Commit
·
1a4c05f
1
Parent(s):
18d5741
chore: update demo to handle event listeners on examples
Browse filesSigned-off-by: Suvaditya Mukherjee <suvadityamuk@gmail.com>
- demos/run_gradio_demo.py +30 -6
demos/run_gradio_demo.py
CHANGED
|
@@ -348,7 +348,15 @@ with gr.Blocks(
|
|
| 348 |
sim_struct_mesh = gr.Model3D(label="Structure Mesh (.glb)", interactive=True, height=300)
|
| 349 |
with gr.Column(scale=2):
|
| 350 |
sim_struct_hidden = gr.Image(type="filepath", visible=False)
|
| 351 |
-
sim_struct_mesh_examples = gr.Examples(examples=EX_STRUCT_THUMBS, inputs=sim_struct_hidden, label="Structure Examples")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
|
| 353 |
with gr.Row(elem_classes="input-row"):
|
| 354 |
with gr.Column(scale=3):
|
|
@@ -371,7 +379,15 @@ with gr.Blocks(
|
|
| 371 |
app_struct_mesh = gr.Model3D(label="Structure Mesh (.glb)", interactive=True, height=300)
|
| 372 |
with gr.Column(scale=2):
|
| 373 |
app_struct_hidden = gr.Image(type="filepath", visible=False)
|
| 374 |
-
app_struct_mesh_examples = gr.Examples(examples=EX_STRUCT_THUMBS, inputs=app_struct_hidden, label="Structure Examples")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
|
| 376 |
with gr.Row(elem_classes="input-row"):
|
| 377 |
with gr.Column(scale=3):
|
|
@@ -384,7 +400,15 @@ with gr.Blocks(
|
|
| 384 |
app_ref_mesh = gr.Model3D(label="Reference Appearance Mesh (.glb)", interactive=True, height=300)
|
| 385 |
with gr.Column(scale=2):
|
| 386 |
app_ref_mesh_hidden = gr.Image(type="filepath", visible=False)
|
| 387 |
-
app_ref_mesh_examples = gr.Examples(examples=EX_MESH_THUMBS, inputs=app_ref_mesh_hidden, label="Mesh Examples")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
|
| 389 |
# --- ADVANCED SETTINGS ---
|
| 390 |
with gr.Accordion("Advanced Settings", open=False):
|
|
@@ -410,9 +434,9 @@ with gr.Blocks(
|
|
| 410 |
output_video = gr.Video(label="Output Video", autoplay=True, loop=True, interactive=False)
|
| 411 |
|
| 412 |
# --- EVENT BINDING ---
|
| 413 |
-
sim_struct_hidden.change(fn=load_mesh_from_thumb, inputs=sim_struct_hidden, outputs=sim_struct_mesh)
|
| 414 |
-
app_struct_hidden.change(fn=load_mesh_from_thumb, inputs=app_struct_hidden, outputs=app_struct_mesh)
|
| 415 |
-
app_ref_mesh_hidden.change(fn=load_mesh_from_thumb, inputs=app_ref_mesh_hidden, outputs=app_ref_mesh)
|
| 416 |
|
| 417 |
tab_sim.select(lambda: "Similarity", outputs=guidance_mode_state)
|
| 418 |
tab_app.select(lambda: "Appearance", outputs=guidance_mode_state)
|
|
|
|
| 348 |
sim_struct_mesh = gr.Model3D(label="Structure Mesh (.glb)", interactive=True, height=300)
|
| 349 |
with gr.Column(scale=2):
|
| 350 |
sim_struct_hidden = gr.Image(type="filepath", visible=False)
|
| 351 |
+
# sim_struct_mesh_examples = gr.Examples(examples=EX_STRUCT_THUMBS, inputs=sim_struct_hidden, label="Structure Examples")
|
| 352 |
+
sim_struct_mesh_examples = gr.Examples(
|
| 353 |
+
examples=EX_STRUCT_THUMBS,
|
| 354 |
+
inputs=sim_struct_hidden,
|
| 355 |
+
outputs=sim_struct_mesh, # Target the 3D viewer directly
|
| 356 |
+
fn=load_mesh_from_thumb, # Run the conversion function
|
| 357 |
+
run_on_click=True, # Force execution on click
|
| 358 |
+
label="Structure Examples"
|
| 359 |
+
)
|
| 360 |
|
| 361 |
with gr.Row(elem_classes="input-row"):
|
| 362 |
with gr.Column(scale=3):
|
|
|
|
| 379 |
app_struct_mesh = gr.Model3D(label="Structure Mesh (.glb)", interactive=True, height=300)
|
| 380 |
with gr.Column(scale=2):
|
| 381 |
app_struct_hidden = gr.Image(type="filepath", visible=False)
|
| 382 |
+
# app_struct_mesh_examples = gr.Examples(examples=EX_STRUCT_THUMBS, inputs=app_struct_hidden, label="Structure Examples")
|
| 383 |
+
app_struct_mesh_examples = gr.Examples(
|
| 384 |
+
examples=EX_STRUCT_THUMBS,
|
| 385 |
+
inputs=app_struct_hidden,
|
| 386 |
+
outputs=app_struct_mesh, # Target the 3D viewer directly
|
| 387 |
+
fn=load_mesh_from_thumb, # Run the conversion function
|
| 388 |
+
run_on_click=True, # Force execution on click
|
| 389 |
+
label="Structure Examples"
|
| 390 |
+
)
|
| 391 |
|
| 392 |
with gr.Row(elem_classes="input-row"):
|
| 393 |
with gr.Column(scale=3):
|
|
|
|
| 400 |
app_ref_mesh = gr.Model3D(label="Reference Appearance Mesh (.glb)", interactive=True, height=300)
|
| 401 |
with gr.Column(scale=2):
|
| 402 |
app_ref_mesh_hidden = gr.Image(type="filepath", visible=False)
|
| 403 |
+
# app_ref_mesh_examples = gr.Examples(examples=EX_MESH_THUMBS, inputs=app_ref_mesh_hidden, label="Mesh Examples")
|
| 404 |
+
app_ref_mesh_examples = gr.Examples(
|
| 405 |
+
examples=EX_MESH_THUMBS,
|
| 406 |
+
inputs=app_ref_mesh_hidden,
|
| 407 |
+
outputs=app_ref_mesh, # Target the 3D viewer directly
|
| 408 |
+
fn=load_mesh_from_thumb, # Run the conversion function
|
| 409 |
+
run_on_click=True, # Force execution on click
|
| 410 |
+
label="Mesh Examples"
|
| 411 |
+
)
|
| 412 |
|
| 413 |
# --- ADVANCED SETTINGS ---
|
| 414 |
with gr.Accordion("Advanced Settings", open=False):
|
|
|
|
| 434 |
output_video = gr.Video(label="Output Video", autoplay=True, loop=True, interactive=False)
|
| 435 |
|
| 436 |
# --- EVENT BINDING ---
|
| 437 |
+
# sim_struct_hidden.change(fn=load_mesh_from_thumb, inputs=sim_struct_hidden, outputs=sim_struct_mesh)
|
| 438 |
+
# app_struct_hidden.change(fn=load_mesh_from_thumb, inputs=app_struct_hidden, outputs=app_struct_mesh)
|
| 439 |
+
# app_ref_mesh_hidden.change(fn=load_mesh_from_thumb, inputs=app_ref_mesh_hidden, outputs=app_ref_mesh)
|
| 440 |
|
| 441 |
tab_sim.select(lambda: "Similarity", outputs=guidance_mode_state)
|
| 442 |
tab_app.select(lambda: "Appearance", outputs=guidance_mode_state)
|