Spaces:
Runtime error
Runtime error
Download test_model.py from Tariq349/WQI_classification: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/spaces/Tariq349/WQI_classification/resolve/main/test_model.py
- Command line
-
hf download hf://spaces/Tariq349/WQI_classification/test_model.py
-
curl -L -o test_model.py https://huggingface.co/spaces/Tariq349/WQI_classification/resolve/main/test_model.py
1.09 kB
| import joblib | |
| import sys | |
| print("Python executable:", sys.executable) | |
| try: | |
| import lightgbm as lgb | |
| print("LightGBM imported successfully!") | |
| except ImportError as e: | |
| print("LightGBM import failed:", e) | |
| sys.exit(1) | |
| try: | |
| model = joblib.load("lightgbm_split2_best_model2 (1).pkl") | |
| print("Model loaded successfully!") | |
| print("Model type:", type(model)) | |
| if hasattr(model, "feature_name"): | |
| print("Model features:", model.feature_name()) | |
| if hasattr(model, "n_features_in_"): | |
| print("Model n_features_in_:", model.n_features_in_) | |
| if hasattr(model, "classes_"): | |
| print("Model classes:", model.classes_) | |
| except Exception as e: | |
| print("Model load failed:", e) | |
| try: | |
| scaler = joblib.load("robust_scaler (1).pkl") | |
| print("Scaler loaded successfully!") | |
| print("Scaler type:", type(scaler)) | |
| if hasattr(scaler, "center_"): | |
| print("Scaler center (medians):", scaler.center_) | |
| if hasattr(scaler, "scale_"): | |
| print("Scaler scale (IQR):", scaler.scale_) | |
| except Exception as e: | |
| print("Scaler load failed:", e) | |