Instructions to use Waleed74/traffic-prediction-pk with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use Waleed74/traffic-prediction-pk with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("Waleed74/traffic-prediction-pk", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
How to use
To load and use this traffic prediction model in Python:
import joblib
from huggingface_hub import hf_hub_download
import pandas as pd
repo_id = "Waleed74/traffic-prediction-pk"
# Download model & encoder
model_path = hf_hub_download(repo_id=repo_id, filename="traffic_classifier.pkl")
encoder_path = hf_hub_download(repo_id=repo_id, filename="target_encoder.pkl")
# Load them
model = joblib.load(model_path)
target_encoder = joblib.load(encoder_path)
feature_names = model.feature_names_in_
print("Feature names:", feature_names)
# Example input row
row = [
18, # Time
2, # Day of the week
320, # CarCount
150, # BikeCount
20, # BusCount
10, # TruckCount
500, # Total
0 # Traffic Situation
]
df = pd.DataFrame([row], columns=feature_names)
prediction = model.predict(df)
predicted_label = target_encoder.inverse_transform(prediction)[0]
print("Predicted Traffic Status:", predicted_label)
- Downloads last month
- -