Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- ui/interface.py +17 -15
ui/interface.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 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.
|
|
@@ -187,32 +190,31 @@ def cute_mushroom_garden_html() -> str:
|
|
| 187 |
</div>
|
| 188 |
'''
|
| 189 |
|
| 190 |
-
def render_shroom_tab():
|
| 191 |
-
with gr.Tabs():
|
| 192 |
-
with gr.Tab("✨ Magic Mushroom Garden"):
|
| 193 |
-
# Notice how we completely removed all the markdown/buttons!
|
| 194 |
-
# Just the beautiful animation now.
|
| 195 |
-
gr.HTML(value=cute_mushroom_garden_html())
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
import gradio as gr
|
| 199 |
-
from game.engine import get_myco_narrative
|
| 200 |
|
| 201 |
def render_shroom_tab():
|
| 202 |
-
with gr.Blocks()
|
| 203 |
with gr.Tab("✨ Magic Mushroom Garden"):
|
| 204 |
-
# 1.
|
| 205 |
gr.HTML(value=cute_mushroom_garden_html())
|
| 206 |
|
| 207 |
-
# 2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
narrative = gr.Markdown(
|
| 209 |
value="Myco is searching for a story hidden in the moss...",
|
| 210 |
elem_id="simple-narrative"
|
| 211 |
)
|
| 212 |
-
|
| 213 |
-
#
|
| 214 |
# Every 20 seconds, it runs your engine function and updates the text
|
| 215 |
gr.Timer(20).tick(fn=get_myco_narrative, outputs=narrative)
|
| 216 |
|
|
|
|
|
|
|
|
|
|
| 217 |
return demo
|
| 218 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import html
|
| 3 |
|
| 4 |
+
import gradio as gr
|
| 5 |
+
from game.engine import get_myco_narrative
|
| 6 |
+
|
| 7 |
def cute_mushroom_garden_html() -> str:
|
| 8 |
"""
|
| 9 |
Pure iframe srcdoc implementation of a cute mushroom garden.
|
|
|
|
| 190 |
</div>
|
| 191 |
'''
|
| 192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
|
| 194 |
def render_shroom_tab():
|
| 195 |
+
with gr.Blocks():
|
| 196 |
with gr.Tab("✨ Magic Mushroom Garden"):
|
| 197 |
+
# 1. The pure animation
|
| 198 |
gr.HTML(value=cute_mushroom_garden_html())
|
| 199 |
|
| 200 |
+
# 2. Subtle attribution - clean and unobtrusive
|
| 201 |
+
gr.Markdown(
|
| 202 |
+
"<sub>*Story generated by Myco AI*</sub>",
|
| 203 |
+
elem_id="ai-attribution"
|
| 204 |
+
)
|
| 205 |
+
|
| 206 |
+
# 3. Simple Markdown component for the narrative
|
| 207 |
narrative = gr.Markdown(
|
| 208 |
value="Myco is searching for a story hidden in the moss...",
|
| 209 |
elem_id="simple-narrative"
|
| 210 |
)
|
| 211 |
+
|
| 212 |
+
# 4. Direct Timer to update the markdown
|
| 213 |
# Every 20 seconds, it runs your engine function and updates the text
|
| 214 |
gr.Timer(20).tick(fn=get_myco_narrative, outputs=narrative)
|
| 215 |
|
| 216 |
+
# 5. Your narrative output
|
| 217 |
+
narrative = gr.Markdown(elem_id="narrative-card")
|
| 218 |
+
|
| 219 |
return demo
|
| 220 |
|