File size: 874 Bytes
b2300e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from __future__ import annotations

from fastapi import FastAPI

from iris.api.routes import router
from iris.config import Settings
from iris.pipeline.orchestrator import VideoProcessor
from iris.storage.database import Database
from iris.storage.files import FileStore


def create_app(settings: Settings | None = None) -> FastAPI:
    app_settings = settings or Settings.from_env()
    app_settings.ensure_directories()

    database = Database(app_settings.database_path)
    database.init()
    file_store = FileStore(app_settings)
    processor = VideoProcessor(app_settings, database, file_store)

    app = FastAPI(title="IRIS", version="0.1.0")
    app.state.settings = app_settings
    app.state.database = database
    app.state.file_store = file_store
    app.state.video_processor = processor
    app.include_router(router)
    return app


app = create_app()