Download scripts/smoke_test_model.py from KLEB38/OC_P8: direct link, hf CLI and curl.
- Browser
- Download file 639 Bytes
-
https://huggingface.co/spaces/KLEB38/OC_P8/resolve/main/scripts/smoke_test_model.py
- Command line
-
hf download hf://spaces/KLEB38/OC_P8/scripts/smoke_test_model.py
-
curl -L -o smoke_test_model.py https://huggingface.co/spaces/KLEB38/OC_P8/resolve/main/scripts/smoke_test_model.py
639 Bytes
| """ | |
| Quick smoke test: reload the exported model and run a dummy prediction. | |
| """ | |
| import joblib | |
| import numpy as np | |
| import pandas as pd | |
| model = joblib.load("models/model.joblib") | |
| print(f"✅ Model reloaded: {type(model)}") | |
| # Dummy prediction with random features | |
| # Adjust n_features if your model expects a specific count | |
| n_features = 768 | |
| dummy = pd.DataFrame(np.random.randn(2, n_features), columns=[f"f_{i}" for i in range(n_features)]) | |
| try: | |
| pred = model.predict(dummy) | |
| print(f"✅ Prediction OK. Shape: {pred.shape}, sample values: {pred[:2]}") | |
| except Exception as e: | |
| print(f"❌ Prediction failed: {type(e).__name__}: {e}") |