ML-005: FastAPI-App-Start und Batch-Sensor-Support finalisieren
This commit is contained in:
@@ -3,7 +3,7 @@ from fastapi import FastAPI
|
|||||||
from backend.routes.ml import init_ml_routes
|
from backend.routes.ml import init_ml_routes
|
||||||
from app.ml.registry.model_registry import ModelRegistry
|
from app.ml.registry.model_registry import ModelRegistry
|
||||||
from app.ml.training import TrainingPipeline
|
from app.ml.training import TrainingPipeline
|
||||||
from app.ml.feature_store import FeatureStore
|
from app.ml.feature_store import FeatureStore, FeatureVector
|
||||||
|
|
||||||
|
|
||||||
def create_app() -> FastAPI:
|
def create_app() -> FastAPI:
|
||||||
@@ -13,6 +13,10 @@ def create_app() -> FastAPI:
|
|||||||
return application
|
return application
|
||||||
|
|
||||||
|
|
||||||
|
def _app_state(): # noqa: ANN001
|
||||||
|
return app.state
|
||||||
|
|
||||||
|
|
||||||
def _seed_default_model(state) -> None: # noqa: ANN001
|
def _seed_default_model(state) -> None: # noqa: ANN001
|
||||||
registry = getattr(state, "registry", None)
|
registry = getattr(state, "registry", None)
|
||||||
if registry is None:
|
if registry is None:
|
||||||
@@ -23,7 +27,8 @@ def _seed_default_model(state) -> None: # noqa: ANN001
|
|||||||
return
|
return
|
||||||
|
|
||||||
store = FeatureStore()
|
store = FeatureStore()
|
||||||
store.add("sensor.kitchen", {"temperature": 19.0})
|
store.add(FeatureVector(sensor_id="sensor.front_door", values={"contact": 1.0}))
|
||||||
|
store.add(FeatureVector(sensor_id="sensor.living_room", values={"temperature": 21.0}))
|
||||||
pipeline = TrainingPipeline(store)
|
pipeline = TrainingPipeline(store)
|
||||||
artifact = pipeline.run("default")
|
artifact = pipeline.run("default")
|
||||||
registry.register(artifact)
|
registry.register(artifact)
|
||||||
|
|||||||
Reference in New Issue
Block a user