-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
45 lines (37 loc) · 1.12 KB
/
main.py
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
41
42
43
44
45
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
from routers import liner, written_digit_recognition, poetry_generator, Chinese_Text_Classification_Pytorch, super_resolution_master
# from routers import watermark_removel
app = FastAPI()
app.docs_url = None
app.redoc_url = None
origins = [
"ai.9998k.cn",
'127.0.0.1',
'null',
'*'
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=False,
allow_methods=["*"],
allow_headers=["*"],
)
#
app.include_router(liner.router)
app.include_router(written_digit_recognition.router)
app.include_router(poetry_generator.router)
app.include_router(Chinese_Text_Classification_Pytorch.router)
app.include_router(super_resolution_master.router)
# app.include_router(watermark_removel.router)
# 由于tensorflow 使用的1.14版本 与main函数其他模型不兼容先不导进来
@app.get("/")
async def main():
return JSONResponse({
"code": 200
})
if __name__ == '__main__':
uvicorn.run('main:app', host='0.0.0.0', port=8000)