Spaces:
Sleeping

byte-vortex commited on
Commit
e360000
·
verified ·
1 Parent(s): 34f275d

Deploy Myco from CI

Browse files
Files changed (1) hide show
  1. 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
- # 1. Assign the block to 'demo' so it can be returned
196
- with gr.Blocks() as demo:
197
- with gr.Tabs():
198
- with gr.Tab("✨ Magic Mushroom Garden"):
199
- # The pure animation
200
- gr.HTML(value=cute_mushroom_garden_html())
201
-
202
- # Subtle attribution
203
- gr.Markdown(
204
- "<sub>*Story generated by Myco AI*</sub>",
205
- elem_id="ai-attribution"
206
- )
207
-
208
- # 2. Define the narrative component ONCE
209
- narrative = gr.Markdown(
210
- value="Myco is searching for a story hidden in the moss...",
211
- elem_id="narrative-card"
212
- )
213
-
214
- # 3. Timer updates the ONE narrative component
215
- gr.Timer(20).tick(fn=get_myco_narrative, outputs=narrative)
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