Update app.py
Browse files
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
|
9 |
-
|
10 |
-
lgb_model = lgb.Booster(model_file="Essay/lightgbm_model.txt")
|
11 |
-
encoder = joblib.load("Essay/scaler_encoder.pkl")
|
12 |
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|