Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- ui/gradio_app.py +198 -92
ui/gradio_app.py
CHANGED
|
@@ -1,149 +1,255 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
from typing import Any, cast
|
|
|
|
| 3 |
|
| 4 |
-
# Engine imports
|
| 5 |
from game.engine import (
|
| 6 |
collect_current, discover_mushroom, eat_current,
|
| 7 |
-
follow_whisper,
|
|
|
|
| 8 |
)
|
| 9 |
from game.state import welcome_history
|
| 10 |
from models.mushroom import Mushroom
|
| 11 |
-
|
| 12 |
-
# Renderer imports (Ensure this file doesn't import ui.renderers!)
|
| 13 |
from ui.renderers import (
|
| 14 |
dex_markdown, forest_scene, game_intro_markdown,
|
| 15 |
game_status_markdown, hero_markdown, home_forest_markdown,
|
| 16 |
-
mushroom_card,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
-
# Constants
|
| 20 |
EMPTY_COLLECTION = None
|
| 21 |
-
START_POSITION
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
def mushroom_card_from_state(current):
|
| 30 |
-
if current is None:
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
def open_play_tab():
|
| 34 |
-
return gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
# โโ App Builder โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 37 |
def build_app():
|
| 38 |
-
with gr.Blocks(title="Myco โ AI Forest Game") as demo:
|
| 39 |
-
#
|
| 40 |
gr.HTML("""
|
| 41 |
<style>
|
| 42 |
-
@keyframes pop {
|
| 43 |
-
0% { transform: scale(0.8); opacity: 0; }
|
| 44 |
-
80% { transform: scale(1.1); }
|
| 45 |
-
100% { transform: scale(1); opacity: 1; }
|
| 46 |
-
}
|
| 47 |
-
.mushroom-spawn { animation: pop 0.5s ease-out; }
|
| 48 |
.gradio-container { background: #1a1a2e !important; }
|
|
|
|
|
|
|
| 49 |
</style>
|
| 50 |
-
<script>
|
| 51 |
-
document.addEventListener('keydown', function(event) {
|
| 52 |
-
if (['INPUT', 'TEXTAREA'].includes(event.target.nodeName)) return;
|
| 53 |
-
const keyMap = {
|
| 54 |
-
'w':'btn-n', 'ArrowUp':'btn-n',
|
| 55 |
-
'a':'btn-w', 'ArrowLeft':'btn-w',
|
| 56 |
-
's':'btn-s', 'ArrowDown':'btn-s',
|
| 57 |
-
'd':'btn-e', 'ArrowRight':'btn-e',
|
| 58 |
-
'e':'btn-pick'
|
| 59 |
-
};
|
| 60 |
-
const btn = document.getElementById(keyMap[event.key]);
|
| 61 |
-
if (btn) btn.click();
|
| 62 |
-
});
|
| 63 |
-
</script>
|
| 64 |
""")
|
| 65 |
|
| 66 |
-
# โโ State โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 67 |
current_mushroom = gr.State(None)
|
| 68 |
-
collection
|
| 69 |
-
player_position
|
| 70 |
|
| 71 |
-
# โโ Layout โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 72 |
gr.HTML(hero_markdown())
|
| 73 |
|
| 74 |
with gr.Tabs(selected="home") as tabs:
|
| 75 |
with gr.Tab("๐ Home", id="home"):
|
|
|
|
| 76 |
gr.HTML(home_forest_markdown())
|
| 77 |
start_play_button = gr.Button("๐ Enter the Forest", variant="primary", size="lg")
|
| 78 |
-
|
|
|
|
| 79 |
with gr.Tab("๐ฎ Play", id="play"):
|
| 80 |
gr.HTML(game_intro_markdown())
|
| 81 |
-
|
| 82 |
-
# Scene
|
| 83 |
-
scene = gr.HTML(forest_scene(None, EMPTY_COLLECTION, START_POSITION),
|
| 84 |
-
elem_id="forest-scene", elem_classes="mushroom-spawn")
|
| 85 |
|
| 86 |
with gr.Row():
|
| 87 |
with gr.Column(scale=1):
|
| 88 |
-
gr.
|
| 89 |
-
|
|
|
|
| 90 |
with gr.Row():
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
|
|
|
|
|
|
|
|
|
| 97 |
with gr.Column(scale=2):
|
| 98 |
-
|
| 99 |
discovery = gr.Markdown(mushroom_card(None))
|
| 100 |
-
|
| 101 |
with gr.Row():
|
| 102 |
-
study_button
|
| 103 |
-
collect_button = gr.Button("๐ Collect")
|
| 104 |
-
|
| 105 |
-
|
|
|
|
| 106 |
|
| 107 |
-
with gr.Column(scale=
|
| 108 |
-
|
|
|
|
| 109 |
with gr.Row():
|
| 110 |
-
prompt = gr.Textbox(placeholder="Ask Myco...", show_label=False)
|
| 111 |
-
ask_button = gr.Button("Ask ๐")
|
| 112 |
|
| 113 |
with gr.Tab("๐ MycoDex"):
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
with gr.Tab("๐บ๏ธ Map"):
|
| 118 |
world_map = gr.HTML(world_map_markdown(EMPTY_COLLECTION))
|
|
|
|
|
|
|
| 119 |
|
| 120 |
-
# โโ Event
|
| 121 |
-
# All click events now correctly reference defined variables
|
| 122 |
start_play_button.click(open_play_tab, outputs=[tabs])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
x, y = _safe_pos(pos)
|
| 127 |
-
if direction == "north": y -= 1
|
| 128 |
-
elif direction == "south": y += 1
|
| 129 |
-
elif direction == "west": x -= 1
|
| 130 |
-
elif direction == "east": x += 1
|
| 131 |
-
new_pos = _safe_pos((x, y))
|
| 132 |
-
return new_pos, forest_scene(curr, coll, new_pos), game_status_markdown(curr, coll, new_pos)
|
| 133 |
-
|
| 134 |
-
for dir, btn in [("north", north_button), ("south", south_button), ("west", west_button), ("east", east_button)]:
|
| 135 |
-
btn.click(move_logic, inputs=[player_position, gr.State(dir), current_mushroom, collection],
|
| 136 |
-
outputs=[player_position, scene, status])
|
| 137 |
-
|
| 138 |
-
# Search / Actions
|
| 139 |
-
search_button.click(discover_mushroom, inputs=[collection],
|
| 140 |
-
outputs=[current_mushroom, scene, status, discovery, chat, dex, progress])
|
| 141 |
|
| 142 |
-
|
| 143 |
-
|
| 144 |
|
| 145 |
-
|
| 146 |
-
outputs=[collection, current_mushroom, scene, status, discovery, dex, world_map, chat, progress])
|
| 147 |
|
|
|
|
| 148 |
return demo
|
| 149 |
|
|
|
|
| 1 |
+
"""Gradio game UI for Myco โ LLM-powered forest adventure."""
|
| 2 |
+
|
| 3 |
from typing import Any, cast
|
| 4 |
+
import gradio as gr
|
| 5 |
|
|
|
|
| 6 |
from game.engine import (
|
| 7 |
collect_current, discover_mushroom, eat_current,
|
| 8 |
+
follow_whisper, hf_companion_status, myco_reply,
|
| 9 |
+
pick_current, study_current,
|
| 10 |
)
|
| 11 |
from game.state import welcome_history
|
| 12 |
from models.mushroom import Mushroom
|
|
|
|
|
|
|
| 13 |
from ui.renderers import (
|
| 14 |
dex_markdown, forest_scene, game_intro_markdown,
|
| 15 |
game_status_markdown, hero_markdown, home_forest_markdown,
|
| 16 |
+
mushroom_card, play_hook_markdown, progress_markdown,
|
| 17 |
+
world_map_markdown,
|
| 18 |
)
|
| 19 |
|
|
|
|
| 20 |
EMPTY_COLLECTION = None
|
| 21 |
+
START_POSITION = (1, 1)
|
| 22 |
|
| 23 |
+
HOME_MARKDOWN = """
|
| 24 |
+
## Welcome to the Myco forest
|
| 25 |
+
|
| 26 |
+
Myco is a tiny AI-powered forest game. Open **๐ฎ Play** to search for mushrooms,
|
| 27 |
+
visit **๐ MycoDex** to review your collection, and use **๐งญ Guide** for help.
|
| 28 |
+
|
| 29 |
+
**Goal:** solve one mystery โ why does Myco remember a forest that vanished before it was born?
|
| 30 |
+
Follow clues until the Impossible Mushroom blooms inside the MycoDex.
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
GUIDE_MARKDOWN = """
|
| 34 |
+
## How to play
|
| 35 |
+
|
| 36 |
+
1. Go to **๐ฎ Play** and click **๐ฎ Search Clearing** to discover a mushroom.
|
| 37 |
+
2. **Myco (the AI) reacts** โ read what it senses about the mushroom.
|
| 38 |
+
3. Choose your action:
|
| 39 |
+
- **๐ Study** โ Myco examines the mushroom and updates its magic field.
|
| 40 |
+
- **๐ Pick** โ grab it as a game item. Poisonous picks = Game Over!
|
| 41 |
+
- **๐ Collect** โ add it to the MycoDex for safe keeping and score.
|
| 42 |
+
- **๐ Follow Whisper** โ reveal mystery fragments. Risky on unstudied mushrooms!
|
| 43 |
+
- **๐ฝ๏ธ Eat?** โ Myco will stop you every time (for good reason).
|
| 44 |
+
4. **Ask Myco** anything in the chat โ it knows the forest, the mystery, and the mushrooms.
|
| 45 |
+
5. Use **โฌ๏ธโฌ๏ธโฌ
๏ธโก๏ธ** to move through the 3ร3 forest grid.
|
| 46 |
+
|
| 47 |
+
**Scoring:** Common = 10 spores ยท Rare = 35 ยท Legendary = 100 ยท Poison = โ25 + Game Over
|
| 48 |
+
|
| 49 |
+
**Poisonous mushrooms:** Ghost Gill ยท Pepper Pixie ยท Ruby Knuckle ยท Clockwork Chanterelle
|
| 50 |
+
"""
|
| 51 |
|
| 52 |
def mushroom_card_from_state(current):
|
| 53 |
+
if current is None:
|
| 54 |
+
return mushroom_card(None)
|
| 55 |
+
return mushroom_card(
|
| 56 |
+
Mushroom.from_dict(current),
|
| 57 |
+
current.get("clue"),
|
| 58 |
+
current.get("secret"),
|
| 59 |
+
current,
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
def search_forest(collection, position):
|
| 63 |
+
mushroom, current, history = discover_mushroom(collection)
|
| 64 |
+
pos = _safe_pos(position)
|
| 65 |
+
return (
|
| 66 |
+
forest_scene(current, collection, pos),
|
| 67 |
+
game_status_markdown(current, collection, pos),
|
| 68 |
+
mushroom_card_from_state(current),
|
| 69 |
+
current,
|
| 70 |
+
history,
|
| 71 |
+
dex_markdown(collection),
|
| 72 |
+
progress_markdown(collection),
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
def ask_companion(message, history, current, collection, position):
|
| 76 |
+
return myco_reply(message, history, current, collection, position)
|
| 77 |
+
|
| 78 |
+
def collect_discovery(current, collection, history, position):
|
| 79 |
+
updated_coll, updated_hist = collect_current(current, collection, history)
|
| 80 |
+
pos = _safe_pos(position)
|
| 81 |
+
return (
|
| 82 |
+
updated_coll,
|
| 83 |
+
forest_scene(current, updated_coll, pos),
|
| 84 |
+
game_status_markdown(current, updated_coll, pos),
|
| 85 |
+
dex_markdown(updated_coll),
|
| 86 |
+
world_map_markdown(updated_coll),
|
| 87 |
+
updated_hist,
|
| 88 |
+
progress_markdown(updated_coll),
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
def pick_discovery(current, collection, history, position):
|
| 92 |
+
updated_coll, updated_current, updated_hist = pick_current(current, collection, history)
|
| 93 |
+
pos = _safe_pos(position)
|
| 94 |
+
return (
|
| 95 |
+
updated_coll,
|
| 96 |
+
updated_current,
|
| 97 |
+
forest_scene(updated_current, updated_coll, pos),
|
| 98 |
+
game_status_markdown(updated_current, updated_coll, pos),
|
| 99 |
+
mushroom_card_from_state(updated_current),
|
| 100 |
+
dex_markdown(updated_coll),
|
| 101 |
+
world_map_markdown(updated_coll),
|
| 102 |
+
updated_hist,
|
| 103 |
+
progress_markdown(updated_coll),
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
def follow_story_whisper(current, collection, history, position):
|
| 107 |
+
updated_current, updated_hist = follow_whisper(current, collection, history)
|
| 108 |
+
pos = _safe_pos(position)
|
| 109 |
+
return (
|
| 110 |
+
updated_current,
|
| 111 |
+
forest_scene(updated_current, collection, pos),
|
| 112 |
+
game_status_markdown(updated_current, collection, pos),
|
| 113 |
+
mushroom_card_from_state(updated_current),
|
| 114 |
+
updated_hist,
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
def study_discovery(current, history, collection, position):
|
| 118 |
+
updated_current, updated_hist = study_current(current, history)
|
| 119 |
+
pos = _safe_pos(position)
|
| 120 |
+
return (
|
| 121 |
+
updated_current,
|
| 122 |
+
forest_scene(updated_current, collection, pos),
|
| 123 |
+
game_status_markdown(updated_current, collection, pos),
|
| 124 |
+
mushroom_card_from_state(updated_current),
|
| 125 |
+
updated_hist,
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
def move_player(position, direction, current, collection):
|
| 129 |
+
x, y = _safe_pos(position)
|
| 130 |
+
if direction == "north": y -= 1
|
| 131 |
+
elif direction == "south": y += 1
|
| 132 |
+
elif direction == "west": x -= 1
|
| 133 |
+
elif direction == "east": x += 1
|
| 134 |
+
pos = _safe_pos((x, y))
|
| 135 |
+
return pos, forest_scene(current, collection, pos), game_status_markdown(current, collection, pos)
|
| 136 |
+
|
| 137 |
+
def block_unsafe_eating(current, history):
|
| 138 |
+
return eat_current(current, history)
|
| 139 |
|
| 140 |
def open_play_tab():
|
| 141 |
+
return gr.update(selected="play")
|
| 142 |
+
|
| 143 |
+
def _safe_pos(position):
|
| 144 |
+
if position is None:
|
| 145 |
+
return START_POSITION
|
| 146 |
+
x, y = position
|
| 147 |
+
return (max(0, min(2, int(x))), max(0, min(2, int(y))))
|
| 148 |
|
|
|
|
| 149 |
def build_app():
|
| 150 |
+
with gr.Blocks(title="Myco โ AI Forest Game", theme=gr.themes.Soft()) as demo:
|
| 151 |
+
# Added 'contain' CSS to prevent layout jumping/flashing
|
| 152 |
gr.HTML("""
|
| 153 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
.gradio-container { background: #1a1a2e !important; }
|
| 155 |
+
#forest-scene, #discovery-card { contain: layout style; content-visibility: auto; }
|
| 156 |
+
.progress-level, .progress-level-inner, .generating { display: none !important; }
|
| 157 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
""")
|
| 159 |
|
|
|
|
| 160 |
current_mushroom = gr.State(None)
|
| 161 |
+
collection = gr.State([])
|
| 162 |
+
player_position = gr.State(START_POSITION)
|
| 163 |
|
|
|
|
| 164 |
gr.HTML(hero_markdown())
|
| 165 |
|
| 166 |
with gr.Tabs(selected="home") as tabs:
|
| 167 |
with gr.Tab("๐ Home", id="home"):
|
| 168 |
+
gr.Markdown(HOME_MARKDOWN)
|
| 169 |
gr.HTML(home_forest_markdown())
|
| 170 |
start_play_button = gr.Button("๐ Enter the Forest", variant="primary", size="lg")
|
| 171 |
+
gr.Markdown(f"*{hf_companion_status()}*")
|
| 172 |
+
|
| 173 |
with gr.Tab("๐ฎ Play", id="play"):
|
| 174 |
gr.HTML(game_intro_markdown())
|
| 175 |
+
scene = gr.HTML(forest_scene(None, EMPTY_COLLECTION, START_POSITION), elem_id="forest-scene")
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
with gr.Row():
|
| 178 |
with gr.Column(scale=1):
|
| 179 |
+
search_button = gr.Button("๐ฎ Search Clearing", variant="primary", size="lg")
|
| 180 |
+
with gr.Column(scale=1):
|
| 181 |
+
gr.Markdown("**Move Myco**")
|
| 182 |
with gr.Row():
|
| 183 |
+
gr.HTML("<div></div>")
|
| 184 |
+
north_button = gr.Button("โฌ๏ธ", size="sm")
|
| 185 |
+
gr.HTML("<div></div>")
|
| 186 |
+
with gr.Row():
|
| 187 |
+
west_button = gr.Button("โฌ
๏ธ", size="sm")
|
| 188 |
+
pick_button = gr.Button("๐ Pick", variant="primary", size="sm")
|
| 189 |
+
east_button = gr.Button("โก๏ธ", size="sm")
|
| 190 |
+
with gr.Row():
|
| 191 |
+
gr.HTML("<div></div>")
|
| 192 |
+
south_button = gr.Button("โฌ๏ธ", size="sm")
|
| 193 |
+
gr.HTML("<div></div>")
|
| 194 |
|
| 195 |
+
status = gr.Markdown(game_status_markdown(None, EMPTY_COLLECTION, START_POSITION))
|
| 196 |
+
|
| 197 |
+
with gr.Row(equal_height=True, elem_id="discovery-card"):
|
| 198 |
with gr.Column(scale=2):
|
| 199 |
+
gr.Markdown("### ๐ Current Discovery")
|
| 200 |
discovery = gr.Markdown(mushroom_card(None))
|
|
|
|
| 201 |
with gr.Row():
|
| 202 |
+
study_button = gr.Button("๐ Study", variant="secondary")
|
| 203 |
+
collect_button = gr.Button("๐ Collect", variant="secondary")
|
| 204 |
+
with gr.Row():
|
| 205 |
+
whisper_button = gr.Button("๐ Follow Whisper", variant="secondary")
|
| 206 |
+
eat_button = gr.Button("๐ฝ๏ธ Eat?", variant="stop")
|
| 207 |
|
| 208 |
+
with gr.Column(scale=3):
|
| 209 |
+
gr.Markdown("### ๐ฌ Myco Chat")
|
| 210 |
+
chat = gr.Chatbot(value=cast(Any, welcome_history()), label="Myco", height=400, show_label=False)
|
| 211 |
with gr.Row():
|
| 212 |
+
prompt = gr.Textbox(placeholder="Ask Myco anything about the forest...", show_label=False, scale=4, lines=1)
|
| 213 |
+
ask_button = gr.Button("Ask ๐", variant="primary", scale=1)
|
| 214 |
|
| 215 |
with gr.Tab("๐ MycoDex"):
|
| 216 |
+
with gr.Row():
|
| 217 |
+
progress = gr.Markdown(progress_markdown(EMPTY_COLLECTION))
|
| 218 |
+
dex = gr.Markdown(dex_markdown(EMPTY_COLLECTION))
|
| 219 |
+
with gr.Tab("๐บ๏ธ World Map"):
|
| 220 |
world_map = gr.HTML(world_map_markdown(EMPTY_COLLECTION))
|
| 221 |
+
with gr.Tab("๐งญ Guide"):
|
| 222 |
+
gr.Markdown(GUIDE_MARKDOWN)
|
| 223 |
|
| 224 |
+
# โโ Event wiring (show_progress="hidden" applied to all for zero-flash) โโ
|
|
|
|
| 225 |
start_play_button.click(open_play_tab, outputs=[tabs])
|
| 226 |
+
|
| 227 |
+
search_button.click(search_forest, inputs=[collection, player_position],
|
| 228 |
+
outputs=[scene, status, discovery, current_mushroom, chat, dex, progress], show_progress="hidden")
|
| 229 |
+
|
| 230 |
+
ask_button.click(ask_companion, inputs=[prompt, chat, current_mushroom, collection, player_position],
|
| 231 |
+
outputs=[prompt, chat], show_progress="hidden")
|
| 232 |
+
prompt.submit(ask_companion, inputs=[prompt, chat, current_mushroom, collection, player_position],
|
| 233 |
+
outputs=[prompt, chat], show_progress="hidden")
|
| 234 |
+
|
| 235 |
+
for direction, button in [("north", north_button), ("south", south_button), ("west", west_button), ("east", east_button)]:
|
| 236 |
+
button.click(move_player, inputs=[player_position, gr.State(direction), current_mushroom, collection],
|
| 237 |
+
outputs=[player_position, scene, status], show_progress="hidden")
|
| 238 |
+
|
| 239 |
+
study_button.click(study_discovery, inputs=[current_mushroom, chat, collection, player_position],
|
| 240 |
+
outputs=[current_mushroom, scene, status, discovery, chat], show_progress="hidden")
|
| 241 |
+
|
| 242 |
+
collect_button.click(collect_discovery, inputs=[current_mushroom, collection, chat, player_position],
|
| 243 |
+
outputs=[collection, scene, status, dex, world_map, chat, progress], show_progress="hidden")
|
| 244 |
|
| 245 |
+
pick_button.click(pick_discovery, inputs=[current_mushroom, collection, chat, player_position],
|
| 246 |
+
outputs=[collection, current_mushroom, scene, status, discovery, dex, world_map, chat, progress], show_progress="hidden")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
|
| 248 |
+
whisper_button.click(follow_story_whisper, inputs=[current_mushroom, collection, chat, player_position],
|
| 249 |
+
outputs=[current_mushroom, scene, status, discovery, chat], show_progress="hidden")
|
| 250 |
|
| 251 |
+
eat_button.click(block_unsafe_eating, inputs=[current_mushroom, chat], outputs=[chat], show_progress="hidden")
|
|
|
|
| 252 |
|
| 253 |
+
demo.queue()
|
| 254 |
return demo
|
| 255 |
|