|
|
from fastapi import FastAPI, Request |
|
|
from fastapi.responses import FileResponse |
|
|
from fastapi.staticfiles import StaticFiles |
|
|
import os |
|
|
import uvicorn |
|
|
|
|
|
|
|
|
app = FastAPI() |
|
|
|
|
|
|
|
|
|
|
|
app.mount("/static", StaticFiles(directory="static"), name="static") |
|
|
|
|
|
|
|
|
@app.get("/") |
|
|
async def read_root(request: Request): |
|
|
""" |
|
|
Esta es la 煤nica ruta que importa. Sirve el archivo index.html |
|
|
que contiene toda la l贸gica de Synapse AI. |
|
|
""" |
|
|
path = os.path.join("templates", "index.html") |
|
|
if os.path.exists(path): |
|
|
return FileResponse(path, media_type="text/html") |
|
|
return {"error": "index.html not found"} |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
|
port = int(os.environ.get("PORT", 7860)) |
|
|
uvicorn.run(app, host="0.0.0.0", port=port) |