LovnishVerma/ONNX
1
๐ธ Iris Flower Classifier (Flask + ONNX)
This project is a simple Flask web application that predicts the species of an Iris flower based on its measurements using a pre-trained Logistic Regression model. The model is exported in ONNX (Open Neural Network Exchange) format, allowing for efficient, framework-independent inference.
๐ Model Training Colab Notebook
https://github.com/lovnishverma/Python-Getting-Started/blob/main/ONNXModelwithYourDataset.ipynb
๐ Live Demo
๐ Enter sepal length, sepal width, petal length, and petal width ๐ Get predicted Iris species: Setosa, Versicolor, or Virginica
๐ Project Structure
.
โโโ app.py # Flask web app
โโโ iris_model.onnx # ONNX-trained model
โโโ Dockerfile # Dockerfile For HuggingFace
โโโ class_labels.json # Class label mapping
โโโ requirements.txt # Required Python packages
โโโ templates/
โโโ index.html # HTML form for input
๐ก Features
- ๐ง Trained with
scikit-learnLogistic Regression - ๐ Converted to ONNX for optimized runtime inference
- ๐ Deployed with Flask and HTML frontend
- ๐ช Clean input form with real-time result display
๐ฆ Setup Instructions
- Clone the Repository
git clone https://github.com/lovnishverma/iris-onnx-flask.git
cd iris-onnx-flask- Install Dependencies
pip install -r requirements.txt- Run the Flask App
python app.py- Open in Browser
http://127.0.0.1:5000๐งช Test Example
Try the following values:
Sepal Length: 5.7
Sepal Width: 3.2
Petal Length: 5.2
Petal Width: 1.9Output:
Predicted Flower Type: virginica๐ค Why ONNX instead of Pickle or Joblib?
โ ONNX is preferred when deploying machine learning models in production or cross-platform environments.
๐ Requirements
flask
onnxruntime
numpy
gunicorn๐ License
This project is licensed under the MIT License.
๐โโ๏ธ Author
Made with โค๏ธ by Lovnish Verma
