This is a simple Flask-based machine learning web application that predicts the species of an Iris flower based on user inputs. The model is trained using Logistic Regression and deployed on Glitch.com.
Click here view youtube video!
- Glitch Project: Glitch Editor
- GitHub Repository: GitHub
- Logistic Regression vs. Linear Regression
- Encoding
- NumPy
- Pandas
- Scaling
- Slicing
- Readme
- DataCleaningGuide
- Flask (Web Framework)
- Scikit-Learn (Machine Learning Model)
- Pandas & NumPy (Data Processing)
- HTML & Jinja2 (Frontend Template Engine)
- Glitch.com (Free Deployment Platform)
✅ Train and deploy a Logistic Regression model for Iris species classification.
✅ Simple web interface to input flower measurements.
✅ Real-time predictions displayed on the web page.
✅ Deployed on Glitch for easy access.
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/lovnishverma/helloworldirismachinelearning.git cd helloworldirismachinelearning
-
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the Flask app:
python app.py
-
Access the web app locally: Open a browser and go to
http://127.0.0.1:5000/
To deploy the app on Glitch:
- Go to Glitch.com
- Click New Project → Import from GitHub
- Paste your repository URL:
https://github.com/lovnishverma/helloworldirismachinelearning
- Wait for the installation to complete.
- Click Preview - Open in a new window to access your app!
This project is licensed under the MIT License.
Feel free to contribute to this project! You can fork the repo, create a new branch, and submit a pull request.
- Scikit-Learn for the ML model.
- Flask for making web deployment easy.
- Glitch for providing free hosting.
This Flask-based Iris Flower Classification project can be improved further with the following enhancements:
✅ Use train-test split for better accuracy – Implement train_test_split
from sklearn.model_selection
to split data into 80% training and 20% testing for better generalization.
Currently, the model is trained on the entire dataset, which is not a good practice because:
- It might memorize the dataset instead of learning general patterns (overfitting).
- We cannot evaluate how well it performs on unseen data.
✅ Feature Scaling for Better Predictions (optional but recommended)– Use StandardScaler
from sklearn.preprocessing
to normalize feature values, ensuring better model performance.
✅ Train Once, Save Model for Future Use – Use joblib
or pickle
to save the trained model and load it later instead of retraining it every time the app runs.
✅ Load Trained Model in Flask – Instead of training on every restart, modify the code to load a pre-trained model for faster predictions.
✅ Enhance UI with Bootstrap – Improve the frontend using Bootstrap for a more professional, responsive, and visually appealing UI.
✅ Error Handling & Input Validation – Implement input validation and exception handling to prevent crashes due to invalid user inputs.
✅ Logging & Debugging – Add logging
to capture errors and debug issues more efficiently in a production environment.
✅ Deploy as a REST API – Convert the app into an API using Flask-RESTful
for better integration with mobile apps or other web services.
✅ Host Model and Project on Hugging Face – Deploy the trained model and project on Hugging Face, which provides 24x7 accessibility.
- Hugging Face is better than Glitch for ML projects as it supports Flask, Streamlit, and Gradio, while Glitch only supports Flask.
✅ Use a Database for Storing Predictions – Store user inputs and predictions in a database like SQLite or PostgreSQL for better data analysis and tracking.
💡 These improvements will make your ML model more efficient, user-friendly, and scalable!
👉 Made with ❤️ by Lovnish Verma 🚀