-
-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (24 loc) · 623 Bytes
/
main.py
File metadata and controls
31 lines (24 loc) · 623 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
# -*- coding: utf-8 -*-
# import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
# import uvicorn
import yaml
from models.RestfulModel import *
from routers import ocr
from utils.ImageHelper import *
app = FastAPI(title="Paddle OCR API",
description="基于 Paddle OCR 和 FastAPI 的自用接口")
# 跨域设置
origins = [
"*"
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"]
)
app.include_router(ocr.router)
# uvicorn.run(app=app, host="0.0.0.0", port=8000)