Download inference.py from Dilipk/flask-classification-model: direct link, hf CLI and curl.
- Browser
- Download file 432 Bytes
-
https://huggingface.co/Dilipk/flask-classification-model/resolve/main/inference.py
- Command line
-
hf download hf://Dilipk/flask-classification-model/inference.py
-
curl -L -o inference.py https://huggingface.co/Dilipk/flask-classification-model/resolve/main/inference.py
432 Bytes
| # inference.py | |
| import joblib | |
| import numpy as np | |
| # Load your model (no scaler) | |
| model = joblib.load('classification_model.joblib') | |
| def predict(input_features): | |
| # Make sure the input is a 2D array (batch_size, num_features) | |
| input_array = np.array(input_features).reshape(1, -1) | |
| prediction = model.predict(input_array) | |
| return prediction.tolist() # Return the prediction as a list for easy JSON handling | |