Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- ui/interface.py +24 -22
ui/interface.py
CHANGED
|
@@ -190,31 +190,33 @@ def cute_mushroom_garden_html() -> str:
|
|
| 190 |
'''
|
| 191 |
|
| 192 |
|
| 193 |
-
|
| 194 |
-
"""Renders the Magic Mushroom Garden into the CALLER's current Blocks
|
| 195 |
-
context. Must be called from inside an existing `with gr.Blocks():`
|
| 196 |
-
(e.g. from within a gr.Tab() in build_app()) — do NOT wrap this in its
|
| 197 |
-
own `with gr.Blocks():`, or these components and the narrative Timer
|
| 198 |
-
end up in a separate Blocks graph that never gets launched, so the tab
|
| 199 |
-
renders empty and the Timer never fires.
|
| 200 |
-
"""
|
| 201 |
-
with gr.Tab("✨ Magic Mushroom Garden"):
|
| 202 |
-
# 1. The full-page background animation
|
| 203 |
-
gr.HTML(value=cute_mushroom_garden_html())
|
| 204 |
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
gr.Markdown(
|
| 215 |
"<sub>*Story generated by Myco AI*</sub>",
|
| 216 |
elem_id="ai-attribution"
|
| 217 |
)
|
| 218 |
|
| 219 |
-
|
| 220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
'''
|
| 191 |
|
| 192 |
|
| 193 |
+
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
|
| 195 |
+
def get_myco_narrative():
|
| 196 |
+
# ... your existing logic to get or generate the story ...
|
| 197 |
+
story = "Myco is searching for a story hidden in the moss..."
|
| 198 |
+
|
| 199 |
+
# Simple: Add the attribution line right to the bottom of the text string
|
| 200 |
+
return f"{story}\n\n<sub style='display: block; opacity: 0.6; margin-top: 0.75rem;'>Story generated by Myco AI</sub>"
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
# Inside your Gradio Interface definition:
|
| 204 |
+
with gr.Tabs():
|
| 205 |
+
with gr.Tab("✨ Magic Mushroom Garden"):
|
| 206 |
+
# The pure animation
|
| 207 |
+
gr.HTML(value=cute_mushroom_garden_html())
|
| 208 |
+
|
| 209 |
+
# Subtle attribution
|
| 210 |
gr.Markdown(
|
| 211 |
"<sub>*Story generated by Myco AI*</sub>",
|
| 212 |
elem_id="ai-attribution"
|
| 213 |
)
|
| 214 |
|
| 215 |
+
# Define the narrative component ONCE
|
| 216 |
+
narrative = gr.Markdown(
|
| 217 |
+
value="Myco is searching for a story hidden in the moss...",
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
# Timer updates the ONE narrative component
|
| 221 |
+
gr.Timer(20).tick(fn=get_myco_narrative, outputs=narrative)
|
| 222 |
+
|