-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
50 lines (37 loc) · 2.13 KB
/
app.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
import os
import uvicorn
from fastapi import FastAPI
from fastapi.responses import PlainTextResponse
from api_src.config.settings import get_settings
from api_src.logger.logger import get_logger
from api_src.routers import router_predict
settings = get_settings()
logger = get_logger(__file__)
ascii_art ="""
░░ ░░░ ░░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░░ ░░ ░░ ░░ ░░░░░░░░ ░░
▒ ▒▒▒▒▒▒▒▒ ▒▒ ▒▒ ▒▒▒▒ ▒▒ ▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒ ▒
▓▓ ▓▓▓ ▓▓ ▓▓▓▓ ▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓ ▓▓▓▓▓▓▓▓ ▓▓▓▓ ▓
███████ ██ █ █ ██ ██ ███ ██████ ███████████ ██ ████ █████ █████ ████████ ████████ ████ █
██ ███ ████ ██ ████ ██ ████ █████ ██████ ███ ████ ██ ██ ██ ██ ██
"""
app = FastAPI(
title="AI API App SMARTSHIELD",
)
app.include_router(router_predict.router)
logger.info(f"Starting App : \n {ascii_art}")
logger.info("App Ready")
@app.get("/", response_class=PlainTextResponse)
async def root():
return ascii_art
if __name__ == "__main__":
try :
uvicorn.run(
app,
port=8002,
host="0.0.0.0",
)
except KeyboardInterrupt as ki :
logger.info("Turning Server Off ...")
logger.info("server Off")
except Exception as e :
logger.error(f"Error occured in app : {e}")