Spaces:
Sleeping
Sleeping
feat: Auto-update object name when selecting examples
Browse files
app.py
CHANGED
|
@@ -599,8 +599,8 @@ def load_example(example_choice):
|
|
| 599 |
for category, examples in example_list.items():
|
| 600 |
for example in examples:
|
| 601 |
if example[1] == example_choice:
|
| 602 |
-
return example[0] # Return
|
| 603 |
-
return None
|
| 604 |
|
| 605 |
|
| 606 |
# Flatten choices for dropdown
|
|
@@ -630,11 +630,6 @@ with demo:
|
|
| 630 |
choices=example_choices, label="Try an Example", value=None
|
| 631 |
)
|
| 632 |
|
| 633 |
-
# Add dropdown change event
|
| 634 |
-
example_dropdown.change(
|
| 635 |
-
fn=load_example, inputs=[example_dropdown], outputs=[svg_file]
|
| 636 |
-
)
|
| 637 |
-
|
| 638 |
with gr.Column(scale=1):
|
| 639 |
with gr.Row(scale=1):
|
| 640 |
with gr.Column(scale=1):
|
|
@@ -644,6 +639,12 @@ with demo:
|
|
| 644 |
placeholder="Give a name to your SVG (e.g., 'dove', 'robot')",
|
| 645 |
value="corgi",
|
| 646 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 647 |
process_btn = gr.Button("🔄 Decompose Structure", variant="primary")
|
| 648 |
groups_summary = gr.Textbox(
|
| 649 |
label="Decomposition Results",
|
|
|
|
| 599 |
for category, examples in example_list.items():
|
| 600 |
for example in examples:
|
| 601 |
if example[1] == example_choice:
|
| 602 |
+
return example[0], example[1] # Return both file path and object name
|
| 603 |
+
return None, None
|
| 604 |
|
| 605 |
|
| 606 |
# Flatten choices for dropdown
|
|
|
|
| 630 |
choices=example_choices, label="Try an Example", value=None
|
| 631 |
)
|
| 632 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 633 |
with gr.Column(scale=1):
|
| 634 |
with gr.Row(scale=1):
|
| 635 |
with gr.Column(scale=1):
|
|
|
|
| 639 |
placeholder="Give a name to your SVG (e.g., 'dove', 'robot')",
|
| 640 |
value="corgi",
|
| 641 |
)
|
| 642 |
+
|
| 643 |
+
# Add dropdown change event
|
| 644 |
+
example_dropdown.change(
|
| 645 |
+
fn=load_example, inputs=[example_dropdown], outputs=[svg_file, object_name]
|
| 646 |
+
)
|
| 647 |
+
|
| 648 |
process_btn = gr.Button("🔄 Decompose Structure", variant="primary")
|
| 649 |
groups_summary = gr.Textbox(
|
| 650 |
label="Decomposition Results",
|