| """Entry point β Forgotten Lily as a Gradio app. |
| |
| The game is a custom HTML/Tailwind/JS frontend served by our FastAPI router |
| (app.server). To satisfy the hackathon's Gradio requirement (and the off-brand |
| UI badge: a custom Gradio UI, unrecognizable from default), we run the whole |
| thing on Gradio: a gr.Blocks app is mounted onto the same server via |
| gr.mount_gradio_app, so Gradio is the framework actually serving the experience. |
| |
| Local: .venv/bin/python app.py (or: uvicorn app:app --port 7860) |
| Game UI: http://localhost:7860/ |
| Gradio: http://localhost:7860/engine (mounted Blocks β control/diagnostics) |
| """ |
| import os |
|
|
| import gradio as gr |
|
|
| |
| |
| _TONES_DIR = os.path.join(os.path.dirname(__file__), "app", "static", "tones") |
| if not os.path.exists(os.path.join(_TONES_DIR, "self_i.wav")): |
| print("[startup] tone WAVs missing β generating with tones/synth.py β¦") |
| from tones import synth |
|
|
| synth.main() |
|
|
| |
| |
| _AUDIO_DIR = os.path.join(os.path.dirname(__file__), "app", "static", "audio") |
| if not os.path.exists(os.path.join(_AUDIO_DIR, "ambient.wav")): |
| print("[startup] ambient bed missing β generating with tones/ambient.py β¦") |
| from tones import ambient |
|
|
| ambient.main() |
|
|
| from app.server import app |
|
|
| with gr.Blocks(title="Forgotten Lily β engine", analytics_enabled=False) as demo: |
| gr.Markdown( |
| "## Forgotten Lily\n" |
| "A narrative mystery told in tones. The game itself runs at the site " |
| "root **/** as a custom frontend. This Gradio surface mounts the engine " |
| "and is where backend controls/diagnostics live." |
| ) |
|
|
| |
| |
| app = gr.mount_gradio_app(app, demo, path="/engine") |
|
|
|
|
| if __name__ == "__main__": |
| import uvicorn |
|
|
| uvicorn.run(app, host="0.0.0.0", port=7860) |
|
|