Spaces:
Configuration error
Configuration error
Download iris_sklearn.py from ariefrahmansyah/iris-classifier: direct link, hf CLI and curl.
- Browser
- Download file 664 Bytes
-
https://huggingface.co/spaces/ariefrahmansyah/iris-classifier/resolve/main/iris_sklearn.py
- Command line
-
hf download hf://spaces/ariefrahmansyah/iris-classifier/iris_sklearn.py
-
curl -L -o iris_sklearn.py https://huggingface.co/spaces/ariefrahmansyah/iris-classifier/resolve/main/iris_sklearn.py
664 Bytes
| import pickle | |
| import streamlit as st | |
| model = pickle.load(open("model.pkl", "rb")) | |
| target_names = ["setosa", "versicolor", "virginica"] | |
| st.title("Iris Classifier 🌺") | |
| sepal_length = st.number_input("Sepal length", key="sepal_length") | |
| sepal_width = st.number_input("Sepal width", key="sepal_width") | |
| petal_length = st.number_input("Petal length", key="petal_length") | |
| petal_width = st.number_input("Petal width", key="petal_width") | |
| if st.button("Predict"): | |
| prediction = model.predict([[sepal_length, sepal_width, petal_length, petal_width]]) | |
| st.write(f"Prediction: {prediction[0]}") | |
| st.write(f"Predicted target name: {target_names[prediction[0]]}") | |