Spaces:
Sleeping
Sleeping
updtae app.py
Browse files
app.py
CHANGED
|
@@ -376,13 +376,14 @@ def preprocess_sound(df):
|
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
-
def xgb_predict_safe(model, X,
|
| 380 |
-
#
|
| 381 |
-
|
| 382 |
-
|
|
|
|
| 383 |
dmatrix = xgb.DMatrix(
|
| 384 |
-
|
| 385 |
-
feature_names=
|
| 386 |
)
|
| 387 |
|
| 388 |
pred = model.get_booster().predict(dmatrix)[0]
|
|
@@ -556,7 +557,7 @@ def predict_with_metadata(url):
|
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
-
return
|
| 560 |
|
| 561 |
|
| 562 |
|
|
|
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
+
def xgb_predict_safe(model, X, label_encoder=None):
|
| 380 |
+
# Sécurité ultime : forcer exactement les features du booster
|
| 381 |
+
booster_features = model.get_booster().feature_names
|
| 382 |
+
X_safe = X.reindex(columns=booster_features, fill_value=0.0).astype(np.float32)
|
| 383 |
+
|
| 384 |
dmatrix = xgb.DMatrix(
|
| 385 |
+
X_safe.values,
|
| 386 |
+
feature_names=booster_features
|
| 387 |
)
|
| 388 |
|
| 389 |
pred = model.get_booster().predict(dmatrix)[0]
|
|
|
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
+
return 'rien à afficher'
|
| 561 |
|
| 562 |
|
| 563 |
|