40 lines
915 B
Python
40 lines
915 B
Python
from datetime import datetime
|
|
import sys
|
|
import os
|
|
from pathlib import Path
|
|
|
|
# Добавляем корневую директорию проекта в PYTHONPATH
|
|
project_root = str(Path(__file__).parent.parent)
|
|
if project_root not in sys.path:
|
|
sys.path.append(project_root)
|
|
|
|
from app.api.v1.endpoints.streaming import router as stream_router
|
|
|
|
import uvicorn
|
|
from typing import Union
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
app = FastAPI(title="Car Plate Detection API")
|
|
|
|
# Configure CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Подключаем маршруты
|
|
app.include_router(stream_router)
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {"message": "Welcome to the API"}
|
|
|
|
if __name__ == "__main__":
|
|
|
|
uvicorn.run(app, host="0.0.0.0", port=8000)
|