mjpsm commited on
Commit
e9c6c37
·
verified ·
1 Parent(s): a50c277

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -4
README.md CHANGED
@@ -71,17 +71,31 @@ On the held-out test set (20% of data):
71
  import joblib
72
  import xgboost as xgb
73
  from sentence_transformers import SentenceTransformer
 
74
 
75
- # Load model + embedder
76
- model = joblib.load("Ubuntu_xgb_model.pkl")
 
 
 
 
 
 
 
 
 
 
77
  embedder = SentenceTransformer("all-mpnet-base-v2")
78
 
79
- # Example prediction
 
 
80
  text = "During our class project, I made sure everyone’s ideas were included."
81
  embedding = embedder.encode([text])
82
  score = model.predict(embedding)[0]
83
 
84
- print("Predicted Ubuntu Score:", score)
 
85
  ```
86
 
87
  ## 🌍 Applications
 
71
  import joblib
72
  import xgboost as xgb
73
  from sentence_transformers import SentenceTransformer
74
+ from huggingface_hub import hf_hub_download
75
 
76
+ # -----------------------------
77
+ # 1. Download model from Hugging Face Hub
78
+ # -----------------------------
79
+ REPO_ID = "mjpsm/Ubuntu_xgb_model" # change if you used a different repo name
80
+ FILENAME = "Ubuntu_xgb_model.pkl"
81
+
82
+ model_path = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
83
+
84
+ # -----------------------------
85
+ # 2. Load model + embedder
86
+ # -----------------------------
87
+ model = joblib.load(model_path)
88
  embedder = SentenceTransformer("all-mpnet-base-v2")
89
 
90
+ # -----------------------------
91
+ # 3. Example prediction
92
+ # -----------------------------
93
  text = "During our class project, I made sure everyone’s ideas were included."
94
  embedding = embedder.encode([text])
95
  score = model.predict(embedding)[0]
96
 
97
+ print("Predicted Ubuntu Score:", round(float(score), 3))
98
+
99
  ```
100
 
101
  ## 🌍 Applications