Instructions to use navya608/random-forest-fraud-detection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use navya608/random-forest-fraud-detection with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("navya608/random-forest-fraud-detection", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download inference.py from navya608/random-forest-fraud-detection: direct link, hf CLI and curl.
- Browser
- Download file 506 Bytes
-
https://huggingface.co/navya608/random-forest-fraud-detection/resolve/main/inference.py
- Command line
-
hf download hf://navya608/random-forest-fraud-detection/inference.py
-
curl -L -o inference.py https://huggingface.co/navya608/random-forest-fraud-detection/resolve/main/inference.py
506 Bytes
| import joblib | |
| import pandas as pd | |
| # Load the model and preprocessor | |
| model = joblib.load('random_forest_model.pkl') | |
| preprocessor = joblib.load('preprocessor.pkl') | |
| scaler = joblib.load('scaler.pkl') | |
| def fraud_detection(data): | |
| # Convert data to DataFrame | |
| df = pd.DataFrame([data]) | |
| # Preprocess the data | |
| X = preprocessor.transform(df) | |
| X_scaled = scaler.transform(X) | |
| # Predict | |
| prediction = model.predict(X_scaled) | |
| return {"fraud_prediction": int(prediction[0])} | |