Spaces:
Runtime error
Runtime error
Download app.py from DunaevStudio/DanudeAi: direct link, hf CLI and curl.
- Browser
- Download file 815 Bytes
-
https://huggingface.co/spaces/DunaevStudio/DanudeAi/resolve/main/app.py
- Command line
-
hf download hf://spaces/DunaevStudio/DanudeAi/app.py
-
curl -L -o app.py https://huggingface.co/spaces/DunaevStudio/DanudeAi/resolve/main/app.py
815 Bytes
| import os | |
| from fastapi import FastAPI | |
| from fastapi.responses import HTMLResponse | |
| from fastapi.middleware.cors import CORSMiddleware | |
| app = FastAPI() | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| async def index(): | |
| try: | |
| with open("index.html", "r", encoding="utf-8") as f: | |
| return HTMLResponse(content=f.read()) | |
| except FileNotFoundError: | |
| return HTMLResponse(content="<h1>index.html not found</h1>", status_code=404) | |
| async def health(): | |
| return {"status": "ok", "service": "DanudeAi Frontend"} | |
| if __name__ == "__main__": | |
| import uvicorn | |
| uvicorn.run(app, host="0.0.0.0", port=int(os.getenv("PORT", "7860"))) |