Spaces:
Running
Running
| """Local dev server for NIGHTWAVE -- NO gradio, Python 3.9 compatible. | |
| Serves the raw radio document at GET "/" (top-level, NOT wrapped in an iframe) | |
| so the browser grants mic + autoplay at the document root, plus the full | |
| /api/* surface from server.create_api(). | |
| Run the whole radio + /api/* in mock mode locally with: | |
| NIGHTWAVE_MOCK=1 python space/devserver.py | |
| then open http://localhost:7860 in a browser. With MODAL_URL/MODAL_KEY/ | |
| MODAL_SECRET set (and NIGHTWAVE_MOCK unset) it proxies to the real Modal engine. | |
| """ | |
| import os | |
| import uvicorn | |
| from fastapi.responses import HTMLResponse | |
| from server import create_api, read_radio_html | |
| api = create_api() | |
| def root_radio(): | |
| # Serve the raw radio doc directly (top-level) for local browser testing. | |
| return HTMLResponse(read_radio_html()) | |
| if __name__ == "__main__": | |
| port = int(os.environ.get("PORT", "7860")) | |
| uvicorn.run(api, host="0.0.0.0", port=port) | |