30 lines
826 B
Python
30 lines
826 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.api.routes import training, samples
|
|
from app.core.config import settings
|
|
|
|
app = FastAPI(
|
|
title="Training Monitor API",
|
|
description="API for monitoring ML training progress and samples",
|
|
version="1.0.0",
|
|
)
|
|
|
|
# Configure CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"], # In production, replace with specific origins
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include routers with versioning
|
|
app.include_router(training.router, prefix=f"{settings.API_VER_STR}/training", tags=["training"])
|
|
app.include_router(samples.router, prefix=f"{settings.API_VER_STR}/samples", tags=["samples"])
|
|
|
|
|
|
@app.get("/health")
|
|
async def health_check():
|
|
return {"status": "healthy"}
|