51 lines
1.1 KiB
Python
51 lines
1.1 KiB
Python
import json
|
|
import cv2
|
|
# from ultralytics import YOLO
|
|
import numpy as np
|
|
import math
|
|
import re
|
|
import os
|
|
import sqlite3
|
|
from datetime import datetime
|
|
# from api.v1.endpoints.streaming import streaming
|
|
|
|
from api.v1.endpoints.streaming import router as stream_router
|
|
# from .api.v1.endpoints.streaming import router as steam_router - 'ээто работало
|
|
|
|
# from paddleocr import PaddleOCR
|
|
import uvicorn
|
|
from typing import Union
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
# from pydantic import BaseModel
|
|
|
|
# class Item(BaseModel):
|
|
# name: str
|
|
# price: float
|
|
# is_offer: Union[bool, None] = None
|
|
|
|
|
|
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)
|