CHANGE: Enable training models
All checks were successful
Build docker container / Build image (push) Successful in 10m29s

This commit is contained in:
2025-12-21 00:26:15 +01:00
parent 2389e17b4c
commit ff51af276d
8 changed files with 225 additions and 87 deletions

30
src/model_registry.py Normal file
View File

@@ -0,0 +1,30 @@
import json
import os
from datetime import datetime
MODEL_DIR = "models"
META_FILE = os.path.join(MODEL_DIR, "metadata.json")
def load_meta():
if not os.path.exists(META_FILE):
return {"current": {}, "history": []}
with open(META_FILE) as f:
return json.load(f)
def save_meta(meta):
os.makedirs(MODEL_DIR, exist_ok=True)
with open(META_FILE, "w") as f:
json.dump(meta, f, indent=2)
def register(model_type, file_name, rows):
meta = load_meta()
entry = {
"type": model_type,
"file": file_name,
"trained_at": datetime.utcnow().isoformat() + "Z",
"rows": rows
}
meta["history"].append(entry)
meta["current"][model_type] = file_name
save_meta(meta)
return entry