Views
No views yet
setosa, versicolor, virginica) from four measurements.StandardScaler Pipelinesepal_length, sepal_width, petal_length, petal_widthpip install huggingface_hub joblib scikit-learn pandas1from huggingface_hub import hf_hub_download
2import joblib, pandas as pd
3
4# Download THIS model by its name from the Hub
5path = hf_hub_download(repo_id="shrisivaj333/iris-flower", filename="model.joblib")
6bundle = joblib.load(path)
7
8pipeline = bundle["pipeline"]
9features = bundle["features"] # ['sepal_length','sepal_width','petal_length','petal_width']
10
11# Predict a flower
12row = pd.DataFrame([[5.1, 3.5, 1.4, 0.2]], columns=features)
13print(pipeline.predict(row)) # -> ['setosa']
14print(pipeline.predict_proba(row)) # confidence per classmodel.joblibpipeline — the fitted scikit-learn Pipeline (scaler + random forest)features — the input column names, in orderclasses — the species labelsStandardScaler + RandomForestClassifier.