mirror of
https://git.isriupjv.fr/ISRI/ai-server
synced 2025-04-24 01:58:12 +02:00
20 lines
No EOL
499 B
Python
20 lines
No EOL
499 B
Python
import fastapi
|
|
import uvicorn
|
|
|
|
from source import meta
|
|
|
|
|
|
class Application(fastapi.FastAPI):
|
|
def __init__(self):
|
|
super().__init__(
|
|
title=meta.name,
|
|
description=meta.description,
|
|
redoc_url=None,
|
|
)
|
|
|
|
async def on_shutdown(self):
|
|
print("Shutdown event detected.")
|
|
|
|
def serve(self, host: str = "0.0.0.0", port: int = 8080):
|
|
self.add_event_handler("shutdown", self.on_shutdown)
|
|
uvicorn.run(self, host=host, port=port) |