Skip to content

kranthikiran885366/ai-ml-projects-docker-kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

🤖 AI ML Projects - Docker & Kubernetes

License: MIT Python 3.9+ TensorFlow PyTorch Streamlit Docker Kubernetes CI/CD Code Quality Machine Learning Web Interface

Developed by: Mallelea Kranthi Kiran

A comprehensive AI-powered application suite featuring three advanced machine learning projects with production-ready deployment capabilities using Docker and Kubernetes. This repository demonstrates modern ML practices including real-time monitoring, interactive web interfaces, and containerized deployment.

🚀 Projects Overview

Project Technology Stack Interface Status Port
🏥 Health Prediction Model PyTorch, Streamlit, OpenAI API, Gemini API Web Dashboard ✅ Active 8501
🐱🐶 Cat & Dog Classifier TensorFlow, EfficientNet, ResNet, Gradio Web Interface ✅ Active 7860
🎬 IMDB Sentiment Analysis Keras, Bidirectional LSTM, NLTK CLI/API ✅ Active -

📋 Table of Contents

🔧 Prerequisites

System Requirements

  • Python: 3.9 or higher
  • Memory: Minimum 8GB RAM (16GB recommended for training)
  • Storage: At least 10GB free space
  • OS: Windows 10/11, macOS 10.15+, or Linux Ubuntu 18.04+

Required Software

  • Git: Version control system
  • pip: Python package installer
  • Docker (optional): For containerized deployment
  • Kubernetes (optional): For orchestrated deployment

API Keys (Optional)

  • OpenAI API Key: For advanced health chatbot features
  • Google Gemini API Key: For AI-powered health assistance
  • Kaggle API: For automatic dataset downloads

GPU Support (Optional but Recommended)

  • NVIDIA GPU: GTX 1060 or better
  • CUDA Toolkit: 11.0 or higher
  • cuDNN: Compatible version with CUDA
  • VRAM: Minimum 6GB for optimal training performance

⚡ Quick Start

1. Clone the Repository

git clone https://github.com/kranthikiran885366/ai-ml-projects-docker-kubernetes.git
cd ai-ml-projects-docker-kubernetes

2. Environment Setup

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activate

3. Install Dependencies

# Install all dependencies
pip install -r requirements.txt

# For development dependencies
pip install -r requirements-dev.txt

4. Quick Setup Script

# Windows
setup.bat

# Linux/Mac
./setup.sh

📁 Project Structure

ai-ml-projects-docker-kubernetes/
├── 🏥 health_model/              # Health prediction system
│   ├── config/
│   │   └── config.py             # Model configuration
│   ├── data/
│   │   ├── diabetes.csv          # Diabetes dataset
│   │   └── heart_disease.csv     # Heart disease dataset
│   ├── models/
│   │   ├── model.py              # PyTorch model architecture
│   │   └── advanced_models.py    # Advanced model variants
│   ├── src/
│   │   ├── app.py                # Streamlit web application
│   │   ├── data_processor.py     # Data preprocessing
│   │   ├── trainer.py            # Training pipeline
│   │   └── main.py               # Main training script
│   ├── utils/
│   │   └── visualization.py      # Plotting utilities
│   └── requirements.txt          # Health model dependencies
│
├── 🐱🐶 src/                      # Cat & Dog classifier (main)
│   ├── model.py                  # TensorFlow model architectures
│   ├── train.py                  # Training pipeline
│   ├── predict.py                # Prediction interface
│   ├── data_loader.py            # Data handling
│   ├── realtime_detection.py     # Webcam detection
│   └── ensemble_model.py         # Model ensemble
│
├── 🎬 imdb_sentiment/            # Sentiment analysis
│   ├── src/
│   │   ├── model.py              # Bidirectional LSTM model
│   │   ├── train.py              # Training script
│   │   ├── predict.py            # Prediction interface
│   │   └── data_loader.py        # Text preprocessing
│   └── requirements.txt          # IMDB model dependencies
│
├── 🐳 k8s/                       # Kubernetes deployment
│   ├── deployment.yaml           # K8s deployment config
│   ├── service.yaml              # K8s service config
│   └── pvc.yaml                  # Persistent volume claims
│
├── 📊 monitoring/                # Monitoring setup
│   └── prometheus.yml            # Prometheus configuration
│
├── 📁 data/                      # Training data
│   ├── cat/                      # Cat images
│   └── dog/                      # Dog images
│
├── 🔧 Configuration Files
│   ├── docker-compose.yml        # Multi-service deployment
│   ├── Dockerfile                # Container configuration
│   ├── requirements.txt          # Main dependencies
│   └── project_config.py         # Global configuration
│
├── 🚀 Execution Scripts
│   ├── run_all.py                # Master orchestrator
│   ├── run_health_app.py         # Health model launcher
│   ├── run_simple.py             # Simple classifier
│   ├── run_advanced.py           # Advanced classifier
│   └── menu.py                   # Interactive menu
│
└── 📋 Documentation
    ├── README.md                 # This file
    └── LICENSE                   # MIT License

🏃 Running the Projects

🚀 Run All Projects (Recommended)

# Master orchestrator - runs all services
python run_all.py

# Windows batch file
run_all.bat

# Docker Compose (all services)
docker-compose up --build

🎯 Run Individual Projects

1. 🏥 Health Prediction Model

# Streamlit web application (Port: 8501)
python run_health_app.py
# or
streamlit run health_model/src/app.py

# Direct training
python health_model/src/main.py

# Access: http://localhost:8501

Features Available:

  • 📊 Real-time health dashboard
  • 🤖 AI-powered health chatbot (OpenAI + Gemini)
  • 📈 Interactive prediction charts
  • 📋 Batch CSV upload and prediction
  • 📱 Real-time health monitoring

2. 🐱🐶 Cat & Dog Classifier

# Interactive menu system
python menu.py

# Simple classifier
python run_simple.py

# Advanced multi-model classifier
python run_advanced.py

# Real-time webcam detection
python src/realtime_detection.py

# Gradio web interface (Port: 7860)
python src/predict.py

Available Models:

  • 🔥 EfficientNetB0 (Transfer Learning)
  • 🏗️ ResNet50V2 (Deep Residual)
  • 🧠 Custom CNN (Lightweight)
  • 🎯 Ensemble Model (Best Performance)

3. 🎬 IMDB Sentiment Analysis

# Download data and train
python imdb_sentiment/run.py --download --train

# Train with custom parameters
python imdb_sentiment/src/train.py --epochs 15 --batch_size 64

# Single prediction
python imdb_sentiment/src/predict.py --text "Great movie!"

# Batch prediction
python imdb_sentiment/src/predict.py --input_file reviews.csv

📊 Individual Project Details

🏥 Health Prediction Model

Advanced health monitoring with AI-powered predictions and real-time dashboard

  • 🧠 Architecture: PyTorch-based neural network with attention mechanism
  • 📊 Features: Real-time monitoring, predictive analytics, risk assessment
  • 🌐 Interface: Streamlit web app with interactive dashboards
  • 🤖 AI Integration: OpenAI GPT-3.5 and Google Gemini chatbots
  • 📈 Analytics: Advanced visualization with Plotly charts
  • 🎯 Datasets: Diabetes and heart disease prediction

Key Capabilities:

  • Real-time health metrics simulation
  • Interactive prediction history
  • Feature importance analysis
  • Confidence scoring and visualization
  • CSV batch processing
  • AI-powered health consultation

Technical Stack:

# Core: PyTorch, Streamlit, Plotly
# AI APIs: OpenAI, Google Gemini
# Data: Pandas, NumPy, Scikit-learn
# Visualization: Matplotlib, Seaborn, Plotly

🐱🐶 Cat & Dog Image Classifier

Multi-architecture computer vision system with real-time detection

  • 🏗️ Models: EfficientNetB0, ResNet50V2, Custom CNN, Ensemble
  • 📷 Input: Images, webcam feed, batch processing
  • ⚡ Performance: Transfer learning with fine-tuning
  • 🔄 Training: Data augmentation, callbacks, model checkpointing
  • 📱 Deployment: Gradio web interface, real-time webcam

Advanced Features:

  • Multiple model architectures comparison
  • Real-time webcam detection with OpenCV
  • Interactive menu system for easy navigation
  • Ensemble model for improved accuracy
  • Training history visualization
  • Model performance evaluation

Technical Stack:

# Core: TensorFlow/Keras, OpenCV
# Models: EfficientNet, ResNet, Custom CNN
# Interface: Gradio, Matplotlib
# Data: PIL, NumPy, Data Augmentation

🎬 IMDB Sentiment Analysis

Natural Language Processing for movie review classification

  • 🧠 Architecture: Bidirectional LSTM with embedding layers
  • 📝 Processing: Advanced text preprocessing with NLTK
  • 🎯 Performance: Binary classification (positive/negative)
  • 🔄 Training: Early stopping, model checkpointing
  • 📊 Analysis: Comprehensive evaluation metrics

NLP Features:

  • Bidirectional LSTM for context understanding
  • Word embedding with trainable layers
  • Text preprocessing and tokenization
  • Dropout layers for regularization
  • Model evaluation with accuracy metrics
  • Batch and single text prediction

Technical Stack:

# Core: TensorFlow/Keras, NLTK
# Model: Bidirectional LSTM, Embedding
# Data: Pandas, NLTK, Scikit-learn
# Evaluation: Matplotlib, Seaborn

🐳 Docker & Kubernetes

Docker Deployment

Multi-Service Setup:

# Build and run all services
docker-compose up --build

# Run in background
docker-compose up -d

# View logs
docker-compose logs -f

Services Included:

  • AI Agent: Main application (Ports: 8501, 7860)
  • Prometheus: Monitoring (Port: 9090)
  • Grafana: Visualization (Port: 3000)

Individual Container:

# Build custom image
docker build -t ai-agents .

# Run with port mapping
docker run -p 8501:8501 -p 7860:7860 ai-agents

Kubernetes Deployment

Deploy to K8s Cluster:

# Apply all configurations
kubectl apply -f k8s/

# Check deployment status
kubectl get pods -l app=ai-agent

# View logs
kubectl logs -l app=ai-agent -f

# Port forwarding for local access
kubectl port-forward service/ai-agent-service 8501:8501

K8s Resources:

  • Deployment: Multi-replica application deployment
  • Service: Load balancer for external access
  • PVC: Persistent storage for data, models, results
  • Secrets: API keys and sensitive configuration

🔍 Monitoring & Testing

Health Monitoring

# System status monitoring
python monitor_status.py

# Service health checks
curl http://localhost:8501/  # Streamlit health
curl http://localhost:7860/  # Gradio health

Testing Suite

# Run all tests
pytest health_model/tests/ -v

# Model-specific tests
python health_model/tests/test_models.py
python health_model/tests/test_data_generator.py

# Performance testing
python src/test_models.py

Logging & Monitoring

  • Application Logs: Structured logging with timestamps
  • Performance Metrics: Real-time system monitoring
  • Error Tracking: Comprehensive error handling
  • Status Dashboard: Live service status updates

🤝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guide
  • Add tests for new features
  • Update documentation
  • Ensure all tests pass
  • Use meaningful commit messages

Project Structure Guidelines

  • Keep models in respective models/ directories
  • Add configuration in config/ folders
  • Place utilities in utils/ directories
  • Update requirements.txt for new dependencies

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

👨💻 Author

Mallelea Kranthi Kiran

  • 🌐 Portfolio: [Your Portfolio URL]
  • 💼 LinkedIn: [Your LinkedIn Profile]
  • 📧 Email: [Your Email]
  • 🐙 GitHub: [Your GitHub Profile]

🙏 Acknowledgments

  • TensorFlow Team - Deep learning framework
  • PyTorch Team - Neural network library
  • Streamlit - Web interface framework
  • Gradio - ML model interfaces
  • OpenAI & Google - AI API services
  • IMDB - Movie review dataset
  • Kaggle Community - Datasets and inspiration
  • Open Source Community - Various libraries and tools

Star this repository if you find it helpful!

📧 Questions? Feel free to open an issue or contact the author.

🚀 Ready to deploy? Check out our Docker and Kubernetes configurations!

Releases

No releases published

Packages

No packages published