-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (25 loc) · 744 Bytes
/
main.py
File metadata and controls
31 lines (25 loc) · 744 Bytes
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
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from api.routes import router
import os
# Create uploads directory
os.makedirs("uploads", exist_ok=True)
os.makedirs("results", exist_ok=True)
app = FastAPI(title="OCR Engine API", version="1.0.0")
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include routes
app.include_router(router, prefix="/ocr")
@app.get("/")
async def root():
return {"message": "OCR Engine API is running!"}
if __name__ == "__main__":
print("Starting OCR Engine API...")
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)