Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- ui/interface.py +22 -23
ui/interface.py
CHANGED
|
@@ -192,27 +192,26 @@ def cute_mushroom_garden_html() -> str:
|
|
| 192 |
|
| 193 |
|
| 194 |
def render_shroom_tab():
|
| 195 |
-
#
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
return demo
|
| 218 |
|
|
|
|
| 192 |
|
| 193 |
|
| 194 |
def render_shroom_tab():
|
| 195 |
+
# Build the tab UI for Myco
|
| 196 |
+
scene_html = gr.HTML()
|
| 197 |
+
thought_html = gr.HTML() # use HTML so markup is not escaped
|
| 198 |
+
dex_md = gr.Markdown()
|
| 199 |
+
|
| 200 |
+
# Bind polling: update scene and thought periodically
|
| 201 |
+
# Use demo.load or gr.load depending on your Gradio version; demo.load shown here
|
| 202 |
+
gr.load(fn=poll_scene, outputs=scene_html, every=1.5)
|
| 203 |
+
gr.load(fn=poll_myco_bubble_html, outputs=thought_html, every=1.5)
|
| 204 |
+
|
| 205 |
+
# Optional: dex button
|
| 206 |
+
def show_dex():
|
| 207 |
+
with _STATE_LOCK:
|
| 208 |
+
coll = copy.deepcopy(STATE.get("collection", []))
|
| 209 |
+
return dex_markdown(coll) if coll else EMPTY_DEX
|
| 210 |
+
|
| 211 |
+
show_dex_btn = gr.Button("Show MycoDex")
|
| 212 |
+
show_dex_btn.click(fn=show_dex, inputs=None, outputs=dex_md)
|
| 213 |
+
|
| 214 |
+
# Return components if needed
|
| 215 |
+
return scene_html, thought_html, dex_md
|
| 216 |
+
|
|
|
|
| 217 |
|