Skip to content

Python | Docker, GitHub Actions, MongoDB | Real-time fruit classification web app with CI/CD integration (NYU SE Spring ’25). Features a TensorFlow ML client for real-time fruit recognition and description.

License

Notifications You must be signed in to change notification settings

cl3880/ml-fruit-identifier

 
 

Repository files navigation

Lint-free ML Client Build & Test Web App Build & Test

Containerized Fruit Recognition App

Project 4 of Software Engineering (CSCI-UA 474) course. This project is a fully containerized system composed of three components:

  • A Flask web app to upload images and display classification results
  • A machine learning client that performs fruit image classification
  • A MongoDB database to store uploaded images and classification metadata

The system uses a webcam to capture fruit images, identifies the fruit via a machine learning model, and fetches a descriptive definition using the Merriam-Webster API. It is designed to be extended with features such as audio feedback, making it useful for visually impaired users or interactive learning environments.


Prerequisites

Before running this app, make sure the following are installed:

Windows with WSL 2

If you are using Windows with WSL 2, you have two options:

Option 1: Enable Docker Desktop WSL 2 Integration (Recommended)

  1. Open Docker Desktop
  2. Go to Settings → Resources → WSL Integration
  3. Enable integration for your Linux distro (e.g., Ubuntu)
  4. Click Apply & Restart

To verify that Docker is available in WSL, run:

docker --version
docker compose version

After installation, verify with:

docker --version
docker compose version

Mac

For macOS users, ensure that Docker Desktop is running before proceeding. You can verify Docker is working with:

docker --version
docker compose version

Running the App

1. Clone the Repository

git clone git@github.com:cl3880/containerized-app-project.git
cd containerized-app-project

2. Set Up Environment Variables

Copy the example .env file and add your Merriam-Webster API key:

cp env.example .env

Edit .env with the following content:

MW_API_KEY=your_mw_api_key_here
MW_URL=https://dictionaryapi.com/api/v3/references/collegiate/json
MONGODB_URI=mongodb://mongodb:27017/containerapp
ML_CLIENT_URI=http://ml_client:5000

Important: You need a valid Merriam-Webster API key for the definition feature to work. You can get a free API key at the Merriam-Webster Developer Center.

3. Build and Start All Containers

docker compose up --build

This command will:

  • Build the Flask web app container
  • Build the ML client container
  • Start the MongoDB container
  • Link all three containers together

This project uses docker compose. If you're using legacy Docker, use docker-compose instead.

4. Access the Application

After the build completes, open your browser to:

http://localhost:5001

5. Stopping the Application

To stop the application, press Ctrl+C in the terminal where Docker Compose is running, or run:

docker compose down

Manual Testing

For manual testing (e.g., verifying classification without using the UI), a helper script is provided.

Two test images are included in web-app/tests/test_data/, along with two sample training images in web-app/tests/sample_training_images

You can run the test upload script as follows:

python -m "web-app.tests.test_upload" banana

Replace banana with one of:

  • apple
  • banana
  • train_apple
  • train_banana

Team Members

Mahmoud Shehata
Patrick Cao
Chris Leu
Syed Naqvi

License

This project is licensed under the GNU General Public License. See the LICENSE file for details.

About

Python | Docker, GitHub Actions, MongoDB | Real-time fruit classification web app with CI/CD integration (NYU SE Spring ’25). Features a TensorFlow ML client for real-time fruit recognition and description.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 68.9%
  • HTML 15.1%
  • CSS 9.4%
  • Shell 3.6%
  • Dockerfile 3.0%