File size: 1,043 Bytes
9cf5fee 124b5b5 9cf5fee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import os
app = FastAPI(
title="AI Content Summariser API",
description="API for summarising text content using NLP models",
version="0.1.0"
)
# Configure CORS
origins = os.getenv("CORS_ORIGINS", "http://localhost:3000").split(",")
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
async def root():
return {"message": "Welcome to the AI Content Summariser API"}
@app.get("/health")
async def health_check():
return {"status": "healthy"}
# Import and include API routes
from app.api.routes import router as api_router
app.include_router(api_router, prefix="/api")
# Import and include async API routes
from app.api.async_routes import router as async_router
app.include_router(async_router, prefix="/api/async")
if __name__ == "__main__":
import uvicorn
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
|