An end-to-end Machine Learning + Flask Web Application that classifies Iris flowers into Setosa, Versicolor,
or Virginica using an SVM (Support Vector Machine) model trained on the classic Iris dataset.
This project combines:
- Machine Learning model training (Scikit-learn)
- Model deployment using Flask API
- Frontend UI (HTML, CSS, JavaScript)
- Real-time prediction of Iris flower species
Users can input flower measurements and get instant predictions powered by an AI model.
- Algorithm: Support Vector Machine (SVM)
- Dataset: Iris dataset
- Sepal Length
- Sepal Width
- Petal Length
- Petal Width
- Setosa
- Versicolor
- Virginica
The trained model is saved as:
SVM.pickle
Iris-Flower-AI-Classifier/
│
├── app.py # Flask backend API
├── SVM.pickle # Trained ML model
├── index.html # Frontend UI
├── style.css # Styling
├── script.js # Frontend logic
└── README.md
- Python
- Flask
- Flask-CORS
- NumPy
- Pickle
- Scikit-learn
- Pandas
- Seaborn
- Matplotlib
- HTML5
- CSS3
- JavaScript
GET /
Returns:
Iris Classifier API is running
POST /predict
Request Body (JSON):
{
"features": [5.1, 3.5, 1.4, 0.2]
}
Response:
{
"prediction": "setosa"
}
- Clone the Repository
git clone https://github.com/Kaveeshamalindi/Iris-Flower-AI-Classifier.git
cd Iris-Flower-AI-Classifier
- Install Dependencies
pip install flask flask-cors numpy scikit-learn
- Run Flask Server
python app.py
Server will run at:
http://127.0.0.1:5000/
- Open index.html in a browser
- Enter:
- Sepal Length
- Sepal Width
- Petal Length
- Petal Width
- Click Predict
- Get instant AI prediction 🎯
The model was trained using the Iris dataset:
Dataset Source:
https://raw.githubusercontent.com/jbrownlee/Datasets/master/iris.csv
Steps:
- Data exploration & visualization
- Train-test split (80/20)
- SVM training
- Model evaluation (accuracy, confusion matrix)
- Save model using pickle
- High accuracy on test dataset
- Evaluated using: Accuracy Score Classification Report Confusion Matrix
- Real-time prediction API
- Simple and clean UI
- Machine learning model integration
- Fully responsive frontend
- Easy to extend with other models
- Add more ML models (Random Forest, KNN, etc.)
- Deploy on cloud (Render / Heroku / AWS)
- Add database logging for predictions
- Improve UI with React
