|
|
|
|
|
from fastapi import FastAPI, Request, HTTPException |
|
from fastapi.templating import Jinja2Templates |
|
from fastapi.responses import HTMLResponse |
|
from fastapi.staticfiles import StaticFiles |
|
from routes.authentication import auth_router |
|
from routes.disease_detection import disease_router |
|
import os |
|
import tensorflow as tf |
|
|
|
|
|
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU'))) |
|
|
|
app = FastAPI() |
|
templates = Jinja2Templates(directory="templates") |
|
|
|
|
|
static_dir = "static" |
|
if os.path.isdir(static_dir): |
|
app.mount("/static", StaticFiles(directory=static_dir), name="static") |
|
else: |
|
raise HTTPException(status_code=500, detail="Static directory not found.") |
|
|
|
|
|
app.include_router(auth_router, prefix="/auth", tags=["Authentication"]) |
|
app.include_router(disease_router, prefix="/disease", tags=["Disease Detection"]) |
|
|
|
@app.get("/", response_class=HTMLResponse) |
|
async def landing_page(request: Request): |
|
"""Render the landing page template.""" |
|
return templates.TemplateResponse("landing.html", {"request": request}) |
|
|