Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,8 +35,8 @@ STD_BANKS = 3.0158890435512125
|
|
| 35 |
# with open("xgb_model(1).json", "r") as f:
|
| 36 |
# params = json.load(f)
|
| 37 |
|
| 38 |
-
xgb_model = XGBRegressor()
|
| 39 |
-
xgb_model.load_model("xgb_model_2.json")
|
| 40 |
|
| 41 |
def predict_score(lat, lon, api_key):
|
| 42 |
# Convert input to tensor
|
|
@@ -54,7 +54,8 @@ def predict_score(lat, lon, api_key):
|
|
| 54 |
|
| 55 |
mu_pred = mu_pred.numpy().flatten()
|
| 56 |
|
| 57 |
-
mu_pred2 = xgb_model.predict(inputs.unsqueeze(0).numpy())
|
|
|
|
| 58 |
|
| 59 |
# r = 1/alpha
|
| 60 |
# p = r / (r + mu_pred)
|
|
@@ -83,7 +84,7 @@ def predict_score(lat, lon, api_key):
|
|
| 83 |
|
| 84 |
# score = np.sigmoid(mu_pred2 - num_banks + 0.1) * 100
|
| 85 |
|
| 86 |
-
score = 100 / (1 + np.exp(num_banks -
|
| 87 |
|
| 88 |
# You can apply any post-processing here
|
| 89 |
return (
|
|
|
|
| 35 |
# with open("xgb_model(1).json", "r") as f:
|
| 36 |
# params = json.load(f)
|
| 37 |
|
| 38 |
+
# xgb_model = XGBRegressor()
|
| 39 |
+
# xgb_model.load_model("xgb_model_2.json")
|
| 40 |
|
| 41 |
def predict_score(lat, lon, api_key):
|
| 42 |
# Convert input to tensor
|
|
|
|
| 54 |
|
| 55 |
mu_pred = mu_pred.numpy().flatten()
|
| 56 |
|
| 57 |
+
# mu_pred2 = xgb_model.predict(inputs.unsqueeze(0).numpy())
|
| 58 |
+
mu_pred2 = 1
|
| 59 |
|
| 60 |
# r = 1/alpha
|
| 61 |
# p = r / (r + mu_pred)
|
|
|
|
| 84 |
|
| 85 |
# score = np.sigmoid(mu_pred2 - num_banks + 0.1) * 100
|
| 86 |
|
| 87 |
+
score = 100 / (1 + np.exp(num_banks - mu_pred))
|
| 88 |
|
| 89 |
# You can apply any post-processing here
|
| 90 |
return (
|