A simple local Streamlit application that uses a Keras MobileNetV2 model to classify the freshness of fruits into fresh, mild, or rotten.
-
Upload an image of a fruit and get a real-time classification.
-
Detailed UI showing:
- Freshness label (
fresh,mild,rotten) - Confidence score
- Icon and recommendation text
- Freshness label (
-
Clone the repository
git clone https://github.com/your-username/fruit-freshness-streamlit.git cd fruit-freshness-streamlit -
Create and activate a virtual environment (recommended)
python3 -m venv venv source venv/bin/activate # macOS/Linux venv\\Scripts\\activate # Windows
-
Install dependencies
pip install -r requirements.txt
-
Add your trained model
-
Place your
model.h5file in the project root. -
Ensure
classify.pypoints to the correct filename:model = load_model("model.h5")
-
-
Start the app
streamlit run app.py
-
Open in browser
- Visit
http://localhost:8501to interact with the UI.
- Visit
fruit-freshness-streamlit/
├── app.py # Main Streamlit script
├── classify.py # Loads model and defines classify_fruit()
├── model.keras # Keras MobileNetV2 weights
├── requirements.txt # Project dependencies
├── styles.css # CSS
└── README.md # This file
- CSS: Edit
styles.cssto tweak card and icon styles.
This project is licensed under the MIT License. See LICENSE for details.