Soulprint Models
Collection
15 items • Updated
import xgboost as xgb
from sentence_transformers import SentenceTransformer
from huggingface_hub import hf_hub_download
# -----------------------------
# 1. Download model from Hugging Face Hub
# -----------------------------
REPO_ID = "mjpsm/Ayo-xgb-model"
FILENAME = "Ayo_xgb_model.json"
model_path = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
# -----------------------------
# 2. Load model + embedder
# -----------------------------
model = xgb.XGBRegressor()
model.load_model(model_path)
embedder = SentenceTransformer("all-mpnet-base-v2")
# -----------------------------
# 3. Example prediction
# -----------------------------
text = "The crowd cheered loudly as the drums pounded."
embedding = embedder.encode([text])
score = model.predict(embedding)[0]
print("Predicted Ayo Score:", round(float(score), 3))