| """FastAPI application for the NLP Topic Analysis REST API.""" | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from .routes import router | |
| app = FastAPI( | |
| title="NLP Topic Analysis API", | |
| description=( | |
| "Automatic topic discovery from a batch of documents using " | |
| "BERTopic (transformer-based) or classical LDA/NMF models." | |
| ), | |
| version="1.0.0", | |
| ) | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| app.include_router(router, prefix="/api/v1", tags=["topics"]) | |
| if __name__ == "__main__": | |
| import uvicorn | |
| uvicorn.run("api.main:app", host="0.0.0.0", port=8001, reload=True) | |