-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
52 lines (37 loc) · 1.17 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
46
47
48
49
50
51
52
import uvicorn
from fastapi import HTTPException
from fastapi.middleware.cors import CORSMiddleware
from fastapi import FastAPI
from app.common.config import conf
from app.routers import missing_value
from app.routers import data
from app.routers import serve
from app.models.response import *
from app.models.exceptions import *
def create_app():
app = FastAPI(
title='Icnslab MLOps data preprocessing',
description='Data Preprocessing api for MLOps',
version='0.1',
docs_url='/docs'
)
# routers
app.include_router(missing_value.router)
app.include_router(data.router)
app.include_router(serve.router)
app.config = conf()
app.add_exception_handler(HTTPException, http_exception_handler)
# app.add_exception_handler(APIException, exception_handler)
app.add_middleware(
CORSMiddleware,
allow_origins=['*'],
allow_credentials=True,
allow_methods=['*'],
allow_headers=['*']
)
return app
app = create_app()
if __name__ == '__main__':
reload = app.config.project_reload
print('hello')
uvicorn.run('main:app', host='0.0.0.0', port=8000, workers=3, reload=reload)