legal-doc-masker/mineru/app/main.py

39 lines
897 B
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from .core.config import settings
from .api.endpoints import mineru
from .core.database import engine, Base
# Create database tables
Base.metadata.create_all(bind=engine)
app = FastAPI(
title=settings.PROJECT_NAME,
openapi_url=f"{settings.API_V1_STR}/openapi.json"
)
# Set up CORS
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # In production, replace with specific origins
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include routers
# app.include_router(
# files.router,
# prefix=f"{settings.API_V1_STR}/files",
# tags=["files"]
# )
app.include_router(
mineru.router,
prefix=f"{settings.API_V1_STR}/mineru",
tags=["mineru"]
)
@app.get("/")
async def root():
return {"message": "Welcome to Legal Document Masker API"}