An interactive Machine Learning web application built with Streamlit, designed to classify Iris flowers into Setosa, Versicolor, or Virginica from four simple measurements.
Clean UI. Accurate predictions. Ready to use. π±
We use the classic Iris dataset (150 samples; 3 species):
- Features
sepal_length(cm)sepal_width(cm)petal_length(cm)petal_width(cm)
- Label
speciesβ {Iris-setosa,Iris-versicolor,Iris-virginica}
Dataset file: IRIS.csv
- Train/test split: 80/20 (
random_state=2) - Classifier: Gaussian Naive Bayes (
sklearn.naive_bayes.GaussianNB) - Save the trained model to
trained_model.sav(viapickle.dump)
- Sliders for the four measurements
- Click Result to run inference
- Minimal, responsive UI
- Fast, lightweight model
- Clear training pipeline in Jupyter Notebook
- Ready-to-deploy model file
βββ IRIS.csv βββ iris.ipynb βββ trained_model.sav βββ streamlit_app.py βββ requirements.txt βββ README.md
- Feature order: Enter the values in this order β
[sepal_length, sepal_width, petal_length, petal_width] - Units: All measurements are in centimeters (cm).
- Value range:
- Sepal Length: 4.3 β 7.9 cm
- Sepal Width: 2.0 β 4.4 cm
- Petal Length: 1.0 β 6.9 cm
- Petal Width: 0.1 β 2.5 cm
- Use the sliders in the app to adjust values and see predictions instantly.
- No installation needed if you use the Launch App button β it runs in your browser.
- For offline use:
- Download the repo.
- Install requirements:
pip install -r requirements.txt - Run the app:
streamlit run streamlit_app.py
- Try slightly changing values to see how predictions switch between Setosa, Versicolor, and Virginica.
This project can be extended and improved in several ways:
- More datasets β Allow users to choose from multiple datasets (e.g., other flower species).
- Model selection β Let users pick different ML algorithms (RandomForest, SVM, etc.) and compare results.
- Accuracy display β Show the modelβs confidence score alongside predictions.
- Data visualization β Add scatter plots or histograms to visualize inputs vs. predictions.
- Mobile optimization β Improve the UI for mobile screens.
- User input history β Show a table of previous predictions during the same session.
- Cloud deployment β Host on Streamlit Cloud, Hugging Face Spaces, or AWS for broader access.
- Streamlit Docs β https://docs.streamlit.io/
- scikit-learn Docs β https://scikit-learn.org/stable/
- Iris Dataset (UCI) β https://archive.ics.uci.edu/ml/datasets/iris
Mohammed Alawfi
π Madinah, Saudi Arabia
This project is licensed under the MIT License. See LICENSE for details.
