Vansh180
Fix model repo reference
1031ecc
raw
history blame contribute delete
999 Bytes
from fastapi import FastAPI
import tensorflow as tf
import joblib
import json
from huggingface_hub import hf_hub_download
app = FastAPI(title="Equilibrium India V1")
MODEL_REPO = "Vansh180/Equilibrium-India-V1" # MODEL repo (not Space)
MODEL_FILENAME = "systemic_risk_model.keras"
# Download model file from model repo into the container filesystem
model_path = hf_hub_download(
repo_id=MODEL_REPO,
filename=MODEL_FILENAME,
repo_type="model"
)
# Load artifacts at startup
model = tf.keras.models.load_model(model_path)
scaler = joblib.load("scaler.pkl")
with open("feature_columns.json") as f:
feature_columns = json.load(f)
with open("config.json") as f:
config = json.load(f)
@app.get("/")
def root():
return {
"status": "ok",
"model": "Equilibrium-India-V1",
"features": feature_columns,
"tickers": config.get("tickers", []),
"model_repo": MODEL_REPO
}
@app.get("/health")
def health():
return {"status": "healthy"}