Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- ui/interface.py +21 -0
ui/interface.py
CHANGED
|
@@ -1,6 +1,27 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import html
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
def cute_mushroom_garden_html() -> str:
|
| 5 |
"""
|
| 6 |
Pure iframe srcdoc implementation of a cute mushroom garden.
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import html
|
| 3 |
|
| 4 |
+
from game.engine import get_myco_narrative
|
| 5 |
+
|
| 6 |
+
def render_shroom_tab():
|
| 7 |
+
with gr.Blocks() as demo:
|
| 8 |
+
# Create a container to hold both the animation and the text
|
| 9 |
+
with gr.Box(elem_id="garden-wrapper"):
|
| 10 |
+
# 1. Your working animation
|
| 11 |
+
gr.HTML(value=cute_mushroom_garden_html())
|
| 12 |
+
|
| 13 |
+
# 2. The narrative overlay
|
| 14 |
+
# We place this inside the same box to make it "part" of the garden
|
| 15 |
+
narrative = gr.Markdown(
|
| 16 |
+
value="Waiting for the forest to wake...",
|
| 17 |
+
elem_id="narrative-overlay"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
# 3. Refresh logic
|
| 21 |
+
gr.Timer(20).tick(fn=get_myco_narrative, outputs=narrative)
|
| 22 |
+
|
| 23 |
+
return demo
|
| 24 |
+
|
| 25 |
def cute_mushroom_garden_html() -> str:
|
| 26 |
"""
|
| 27 |
Pure iframe srcdoc implementation of a cute mushroom garden.
|