Spaces:
Sleeping

byte-vortex commited on
Commit
5ea4908
·
verified ·
1 Parent(s): 80a67e5

Deploy Myco from CI

Browse files
Files changed (1) hide show
  1. ui/interface.py +13 -13
ui/interface.py CHANGED
@@ -1,33 +1,33 @@
1
  import gradio as gr
2
  from game.engine import get_myco_narrative
3
 
4
- def render_garden_page():
5
- with gr.Blocks(css="""
6
- #garden-canvas { width: 100%; height: 400px; background: #2a4c5e; border-radius: 12px; }
7
- #narrative-box { font-family: 'Courier New', monospace; font-size: 16px; color: #4a3b32; text-align: center; padding: 20px; }
8
- """) as demo:
9
 
10
- # 1. The Canvas
11
- garden_canvas = gr.HTML("<canvas id='garden-canvas'></canvas>")
12
 
13
- # 2. The Narrative Text (Updated by the AI engine)
14
  narrative = gr.Markdown(value=get_myco_narrative(), elem_id="narrative-box")
15
 
16
- # 3. Refresh Timer (Updates every 10 seconds)
17
  gr.Timer(10).tick(get_myco_narrative, outputs=narrative)
18
 
19
- # 4. The Animation Logic (Pure JS injected once)
20
  gr.HTML("""
21
  <script>
22
  const canvas = document.getElementById('garden-canvas');
23
  const ctx = canvas.getContext('2d');
24
- // ... [Insert your cute mushroom drawing loop here] ...
 
25
  function drawLoop() {
26
- // Your drawing logic
27
  requestAnimationFrame(drawLoop);
28
  }
29
  drawLoop();
30
  </script>
31
  """)
32
-
33
  return demo
 
1
  import gradio as gr
2
  from game.engine import get_myco_narrative
3
 
4
+ def render_shroom_tab(): # Kept this name so the import works
5
+ """
6
+ Renders the garden and narrative without any tabs.
7
+ """
8
+ with gr.Blocks(css="#garden-canvas { width: 100%; height: 400px; background: #2a4c5e; border-radius: 12px; }") as demo:
9
 
10
+ # 1. The Canvas (Pure animation, no tab container)
11
+ gr.HTML("<canvas id='garden-canvas'></canvas>")
12
 
13
+ # 2. The Narrative Text (Engine-powered)
14
  narrative = gr.Markdown(value=get_myco_narrative(), elem_id="narrative-box")
15
 
16
+ # 3. Refresh Timer
17
  gr.Timer(10).tick(get_myco_narrative, outputs=narrative)
18
 
19
+ # 4. Injection of the animation logic
20
  gr.HTML("""
21
  <script>
22
  const canvas = document.getElementById('garden-canvas');
23
  const ctx = canvas.getContext('2d');
24
+
25
+ // Your drawing logic here
26
  function drawLoop() {
27
+ // ... animation code ...
28
  requestAnimationFrame(drawLoop);
29
  }
30
  drawLoop();
31
  </script>
32
  """)
 
33
  return demo