Nawal20 commited on
Commit
d2415b3
·
verified ·
1 Parent(s): 17eba83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -5,13 +5,20 @@ import lightgbm as lgb
5
  from sentence_transformers import SentenceTransformer
6
  import numpy as np
7
 
8
- # Load models from Hugging Face Hub
9
- ridge = joblib.load("Essay/ridge_model.pkl")
10
- lgb_model = lgb.Booster(model_file="Essay/lightgbm_model.txt")
11
- encoder = joblib.load("Essay/scaler_encoder.pkl")
12
 
13
- # Load metadata column order
14
- with open("Essay/metadata_columns.json", "r") as f:
 
 
 
 
 
 
 
 
 
15
  metadata_columns = json.load(f)
16
 
17
  # Load SBERT model (will download at runtime)
 
5
  from sentence_transformers import SentenceTransformer
6
  import numpy as np
7
 
8
+ # Load files from the model repo "your-username/Essay"
9
+ repo_id = "Nawal20/Essay"
 
 
10
 
11
+ ridge_path = hf_hub_download(repo_id=repo_id, filename="ridge_model.pkl")
12
+ lgb_path = hf_hub_download(repo_id=repo_id, filename="lightgbm_model.txt")
13
+ encoder_path = hf_hub_download(repo_id=repo_id, filename="scaler_encoder.pkl")
14
+ metadata_path = hf_hub_download(repo_id=repo_id, filename="metadata_columns.json")
15
+
16
+ # Load the models and encoder
17
+ ridge = joblib.load(ridge_path)
18
+ lgb_model = lgb.Booster(model_file=lgb_path)
19
+ encoder = joblib.load(encoder_path)
20
+
21
+ with open(metadata_path, "r") as f:
22
  metadata_columns = json.load(f)
23
 
24
  # Load SBERT model (will download at runtime)