fruit-classifier / DOCKER_GUIDE.md
nahinfarhan's picture
Upload 7 files
e0a956c verified
|
Raw History Blame Contribute Delete
1.97 kB

A newer version of the Streamlit SDK is available: 1.68.0

Upgrade

Docker Deployment Guide

Prerequisites

  • Docker installed on your system
  • Docker Compose installed

Quick Start

1. Build and Run with Docker Compose

# Clone the repository
git clone <repository-url>
cd ML_Project

# Build and start containers
docker-compose up --build

# Run in background (detached mode)
docker-compose up -d --build

2. Access the Application

3. Stop the Application

# Stop containers
docker-compose down

# Stop and remove volumes
docker-compose down -v

Manual Docker Commands

Build Image

docker build -t fruit-classifier .

Run Container

docker run -p 5001:5000 -p 8502:8501 fruit-classifier

Run in Background

docker run -d -p 5001:5000 -p 8502:8501 --name fruit-app fruit-classifier

API Usage Examples

Test Health Endpoint

curl http://localhost:5001/health

Predict with Image

curl -X POST -F "file=@path/to/your/image.jpg" http://localhost:5001/predict

Troubleshooting

Port Conflicts

If ports 5001 or 8502 are in use, modify docker-compose.yml:

ports:
  - "5002:5000"  # Change external port
  - "8503:8501"  # Change external port

View Logs

# View all logs
docker-compose logs

# Follow logs in real-time
docker-compose logs -f

# View specific service logs
docker-compose logs fruit-classifier

Container Management

# List running containers
docker ps

# Stop specific container
docker stop <container-name>

# Remove container
docker rm <container-name>

# Remove image
docker rmi fruit-classifier

Model Requirements

  • Place your trained model file multi_task_resnet152.keras in the project root
  • Model should accept 224x224x3 RGB images
  • Model should output fruit classification and freshness probabilities