Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- ui/gradio_app.py +26 -8
ui/gradio_app.py
CHANGED
|
@@ -375,6 +375,8 @@ def build_app():
|
|
| 375 |
collection = gr.State([])
|
| 376 |
player_position = gr.State(START_POSITION)
|
| 377 |
|
|
|
|
|
|
|
| 378 |
gr.HTML(hero_markdown())
|
| 379 |
|
| 380 |
with gr.Tabs(selected="home") as tabs:
|
|
@@ -461,14 +463,30 @@ def build_app():
|
|
| 461 |
# FIX: each button gets its own .click() with a hardcoded gr.State string
|
| 462 |
# so the direction value is baked in at definition time, not captured from
|
| 463 |
# a loop variable (which would make all four buttons pass "east").
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 472 |
|
| 473 |
study_button.click(study_discovery, inputs=[current_mushroom, chat, collection, player_position],
|
| 474 |
outputs=[current_mushroom, scene, status, discovery, chat], show_progress="hidden")
|
|
|
|
| 375 |
collection = gr.State([])
|
| 376 |
player_position = gr.State(START_POSITION)
|
| 377 |
|
| 378 |
+
active_mushrooms = gr.State([])
|
| 379 |
+
|
| 380 |
gr.HTML(hero_markdown())
|
| 381 |
|
| 382 |
with gr.Tabs(selected="home") as tabs:
|
|
|
|
| 463 |
# FIX: each button gets its own .click() with a hardcoded gr.State string
|
| 464 |
# so the direction value is baked in at definition time, not captured from
|
| 465 |
# a loop variable (which would make all four buttons pass "east").
|
| 466 |
+
# --- Directional Button Wiring ---
|
| 467 |
+
north_button.click(
|
| 468 |
+
move_player,
|
| 469 |
+
inputs=[player_position, gr.State("north"), collection, active_mushrooms],
|
| 470 |
+
outputs=[player_position, scene, status, discovery, current_mushroom, chat, dex, progress, active_mushrooms]
|
| 471 |
+
)
|
| 472 |
+
|
| 473 |
+
south_button.click(
|
| 474 |
+
move_player,
|
| 475 |
+
inputs=[player_position, gr.State("south"), collection, active_mushrooms],
|
| 476 |
+
outputs=[player_position, scene, status, discovery, current_mushroom, chat, dex, progress, active_mushrooms]
|
| 477 |
+
)
|
| 478 |
+
|
| 479 |
+
west_button.click(
|
| 480 |
+
move_player,
|
| 481 |
+
inputs=[player_position, gr.State("west"), collection, active_mushrooms],
|
| 482 |
+
outputs=[player_position, scene, status, discovery, current_mushroom, chat, dex, progress, active_mushrooms]
|
| 483 |
+
)
|
| 484 |
+
|
| 485 |
+
east_button.click(
|
| 486 |
+
move_player,
|
| 487 |
+
inputs=[player_position, gr.State("east"), collection, active_mushrooms],
|
| 488 |
+
outputs=[player_position, scene, status, discovery, current_mushroom, chat, dex, progress, active_mushrooms]
|
| 489 |
+
)
|
| 490 |
|
| 491 |
study_button.click(study_discovery, inputs=[current_mushroom, chat, collection, player_position],
|
| 492 |
outputs=[current_mushroom, scene, status, discovery, chat], show_progress="hidden")
|