from fastapi import FastAPI from backend.routes.ml import init_ml_routes from app.ml.registry.model_registry import ModelRegistry from app.ml.training import TrainingPipeline from app.ml.feature_store import FeatureStore def create_app() -> FastAPI: application = FastAPI(title="SillyHome Next ML") init_ml_routes(application) _seed_default_model(application.state if hasattr(application, "state") else application) return application def _seed_default_model(state) -> None: # noqa: ANN001 registry = getattr(state, "registry", None) if registry is None: registry = ModelRegistry(".model_store") state.registry = registry if list(registry.list_models()): return store = FeatureStore() store.add("sensor.kitchen", {"temperature": 19.0}) pipeline = TrainingPipeline(store) artifact = pipeline.run("default") registry.register(artifact) app = create_app()