Spaces:
Runtime error
Runtime error
UI: remove example 09 pinning from dropdown and remove direct Load Qwen Example button
Browse files- kimodo/demo/ui.py +3 -17
kimodo/demo/ui.py
CHANGED
|
@@ -288,9 +288,7 @@ def create_gui(
|
|
| 288 |
with client.gui.add_folder("Examples", expand_by_default=True):
|
| 289 |
examples_base_dir = demo.get_examples_base_dir(model_name, absolute=True)
|
| 290 |
example_dict = viser_utils.load_example_cases(examples_base_dir)
|
| 291 |
-
|
| 292 |
-
# Keep 09 visible and selected by default so it is impossible to miss.
|
| 293 |
-
example_names = [QWEN_EXAMPLE_NAME] + disk_example_names
|
| 294 |
gui_examples_debug = client.gui.add_markdown(
|
| 295 |
content=f"Examples loaded: {len(example_names)} | Has 09: {QWEN_EXAMPLE_NAME in example_names}"
|
| 296 |
)
|
|
@@ -303,19 +301,12 @@ def create_gui(
|
|
| 303 |
gui_examples_dropdown = client.gui.add_dropdown(
|
| 304 |
"Example",
|
| 305 |
options=example_names,
|
| 306 |
-
initial_value=QWEN_EXAMPLE_NAME,
|
| 307 |
)
|
| 308 |
gui_load_example_button = client.gui.add_button(
|
| 309 |
"Load Example",
|
| 310 |
-
hint="Load the selected example
|
| 311 |
disabled=False,
|
| 312 |
)
|
| 313 |
-
gui_load_qwen_example_button = client.gui.add_button(
|
| 314 |
-
"Load Qwen Example (09)",
|
| 315 |
-
hint="Directly load the Qwen agentic example plan, bypassing dropdown selection.",
|
| 316 |
-
disabled=False,
|
| 317 |
-
color="blue",
|
| 318 |
-
)
|
| 319 |
|
| 320 |
def update_examples_dropdown(
|
| 321 |
new_example_dict: dict[str, str],
|
|
@@ -326,10 +317,7 @@ def create_gui(
|
|
| 326 |
f" client={client_id} model={model_name} keep_selection={keep_selection}"
|
| 327 |
f" incoming_count={len(new_example_dict)} current_value={gui_examples_dropdown.value}"
|
| 328 |
)
|
| 329 |
-
|
| 330 |
-
example_names_local = [QWEN_EXAMPLE_NAME] + disk_names_local
|
| 331 |
-
if QWEN_EXAMPLE_LEGACY_NAME not in example_names_local:
|
| 332 |
-
example_names_local.append(QWEN_EXAMPLE_LEGACY_NAME)
|
| 333 |
gui_examples_dropdown.options = example_names_local
|
| 334 |
gui_examples_debug.content = (
|
| 335 |
f"Examples loaded: {len(example_names_local)} | "
|
|
@@ -339,12 +327,10 @@ def create_gui(
|
|
| 339 |
"[kimodo][examples][update][exit]"
|
| 340 |
f" client={client_id} model={model_name} count={len(example_names_local)}"
|
| 341 |
f" has_09={QWEN_EXAMPLE_NAME in example_names_local}"
|
| 342 |
-
f" has_legacy={QWEN_EXAMPLE_LEGACY_NAME in example_names_local}"
|
| 343 |
f" tail={example_names_local[-3:] if len(example_names_local) >= 3 else example_names_local}"
|
| 344 |
)
|
| 345 |
if keep_selection and gui_examples_dropdown.value in example_names_local:
|
| 346 |
return
|
| 347 |
-
gui_examples_dropdown.value = QWEN_EXAMPLE_NAME
|
| 348 |
|
| 349 |
with client.gui.add_folder("Generate", expand_by_default=True):
|
| 350 |
gui_duration = client.gui.add_markdown(content=f"Total duration: {DEFAULT_CUR_DURATION:.1f} (sec)")
|
|
|
|
| 288 |
with client.gui.add_folder("Examples", expand_by_default=True):
|
| 289 |
examples_base_dir = demo.get_examples_base_dir(model_name, absolute=True)
|
| 290 |
example_dict = viser_utils.load_example_cases(examples_base_dir)
|
| 291 |
+
example_names = list(example_dict.keys())
|
|
|
|
|
|
|
| 292 |
gui_examples_debug = client.gui.add_markdown(
|
| 293 |
content=f"Examples loaded: {len(example_names)} | Has 09: {QWEN_EXAMPLE_NAME in example_names}"
|
| 294 |
)
|
|
|
|
| 301 |
gui_examples_dropdown = client.gui.add_dropdown(
|
| 302 |
"Example",
|
| 303 |
options=example_names,
|
|
|
|
| 304 |
)
|
| 305 |
gui_load_example_button = client.gui.add_button(
|
| 306 |
"Load Example",
|
| 307 |
+
hint="Load the selected example.",
|
| 308 |
disabled=False,
|
| 309 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
|
| 311 |
def update_examples_dropdown(
|
| 312 |
new_example_dict: dict[str, str],
|
|
|
|
| 317 |
f" client={client_id} model={model_name} keep_selection={keep_selection}"
|
| 318 |
f" incoming_count={len(new_example_dict)} current_value={gui_examples_dropdown.value}"
|
| 319 |
)
|
| 320 |
+
example_names_local = list(new_example_dict.keys())
|
|
|
|
|
|
|
|
|
|
| 321 |
gui_examples_dropdown.options = example_names_local
|
| 322 |
gui_examples_debug.content = (
|
| 323 |
f"Examples loaded: {len(example_names_local)} | "
|
|
|
|
| 327 |
"[kimodo][examples][update][exit]"
|
| 328 |
f" client={client_id} model={model_name} count={len(example_names_local)}"
|
| 329 |
f" has_09={QWEN_EXAMPLE_NAME in example_names_local}"
|
|
|
|
| 330 |
f" tail={example_names_local[-3:] if len(example_names_local) >= 3 else example_names_local}"
|
| 331 |
)
|
| 332 |
if keep_selection and gui_examples_dropdown.value in example_names_local:
|
| 333 |
return
|
|
|
|
| 334 |
|
| 335 |
with client.gui.add_folder("Generate", expand_by_default=True):
|
| 336 |
gui_duration = client.gui.add_markdown(content=f"Total duration: {DEFAULT_CUR_DURATION:.1f} (sec)")
|