neural-cryptanalysis / backend_main.py
ayana123's picture
updated for deployment
f937622
Raw
History Blame Contribute Delete
714 Bytes
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.responses import RedirectResponse
import os
import uvicorn
from api.routes import router as api_router
app = FastAPI(title="Neural Cryptanalysis WebApp")
app.include_router(api_router)
# Serve the static frontend files
FRONTEND_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "frontend")
os.makedirs(FRONTEND_DIR, exist_ok=True)
app.mount("/static", StaticFiles(directory=FRONTEND_DIR), name="static")
@app.get("/")
def read_root():
return RedirectResponse(url="/static/index.html")
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=7860) # Port 7860 is default for HuggingFace Spaces