An AI-powered low-code application that uses Google's Gemini 2.0 Flash to analyze car images and provide detailed information about make, model, year, and more. Built with Gradio, containerized with Docker, and deployed on Kubernetes.
- β Car Detection: Automatically identifies if uploaded image contains a car
- π Detailed Analysis: Extracts make, model, year, body type, color, and condition
- π¨ Minimal UI: Clean, user-friendly Gradio interface
- π³ Containerized: Fully dockerized for easy deployment
- βΈοΈ Kubernetes Ready: Complete K8s manifests included
- π CI/CD Pipeline: Automated build and deployment with GitHub Actions
- π€ AI-Powered: Uses Gemini 2.0 Flash with optimized temperature settings
User Browser β Gradio UI (Port 7860) β Python Backend β Gemini 2.0 Flash API β Response
- Frontend: Gradio (Low-code UI framework)
- Backend: Python 3.11
- AI Model: Gemini 2.0 Flash (gemini-2.0-flash-exp)
- Container: Docker
- Orchestration: Kubernetes/OpenShift
- CI/CD: GitHub Actions
- Registry: Docker Hub
- Python 3.11+
- Docker
- Kubernetes cluster (or Minikube/OpenShift)
- Gemini API key (Get one here)
- Docker Hub account
- kubectl configured
- Clone the repository
git clone https://github.com/your-username/car-inspector.git
cd car-inspector- Set up environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Configure API key
cp .env.example .env
# Edit .env and add your Gemini API key- Run the application
python app.py- Open browser
http://localhost:7860
- Build Docker image
docker build -t car-inspector:latest .- Run container
docker run -p 7860:7860 -e GEMINI_API_KEY=your_api_key car-inspector:latest- Access application
http://localhost:7860
- Create secret with API key
kubectl create secret generic car-inspector-secret \
--from-literal=GEMINI_API_KEY=your_actual_api_key-
Update deployment image Edit
kubernetes/deployment.yamland replaceyour-dockerhub-usernamewith your actual Docker Hub username. -
Apply Kubernetes manifests
kubectl apply -f kubernetes/secret.yaml
kubectl apply -f kubernetes/deployment.yaml
kubectl apply -f kubernetes/service.yaml- Check deployment status
kubectl get pods
kubectl get services- Access application
# For LoadBalancer
kubectl get service car-inspector-service
# For NodePort
kubectl get nodes -o wide
# Access at http://<node-ip>:30860These settings are intentionally hardcoded for consistency:
MODEL_NAME = "gemini-2.0-flash-exp"
TEMPERATURE = 0.4GEMINI_API_KEY: Your Gemini API key (required)
car-inspector/
βββ app.py # Main Gradio application
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker configuration
βββ .dockerignore # Docker ignore file
βββ .env.example # Environment template
βββ README.md # This file
βββ kubernetes/
β βββ deployment.yaml # K8s deployment
β βββ service.yaml # K8s service
β βββ secret.yaml # K8s secret template
βββ .github/
β βββ workflows/
β βββ ci-cd.yaml # CI/CD pipeline
βββ capstone_reflection.md # Project documentation
The project includes a GitHub Actions workflow that:
- Builds and tests the application
- Creates Docker image with commit SHA and latest tags
- Pushes to Docker Hub
- Deploys to Kubernetes (manual trigger or automated)
Add these secrets to your GitHub repository:
DOCKER_USERNAME: Your Docker Hub usernameDOCKER_PASSWORD: Your Docker Hub password/tokenKUBECONFIG: Your Kubernetes config (optional, for auto-deployment)
- Upload a car image: Should provide detailed analysis
- Upload a non-car image: Should display warning message
- Test various car types: Sedans, SUVs, trucks, sports cars
- Test edge cases: Poor lighting, multiple cars, partial views
β
Car Detected Successfully!
π AI Analysis Results:
- Make: Toyota
- Model: Camry
- Year: 2020-2023 (8th generation)
- Body Type: Sedan
- Color: Silver/Gray
- Condition: Excellent
- Features: LED headlights, modern design
- Facts: One of the best-selling sedans globally
kubectl get pods -w
kubectl logs -f deployment/car-inspectorkubectl describe service car-inspector-servicekubectl top pods- API keys stored in Kubernetes Secrets
- No hardcoded credentials in code
- Environment variable injection
- Resource limits applied
- Regular security updates
1. Gradio not accessible in container
- Ensure
server_name="0.0.0.0"in app.py - Check port 7860 is exposed
2. Gemini API errors
- Verify API key is correct
- Check API quota/rate limits
- Ensure internet connectivity
3. Kubernetes pods not starting
kubectl describe pod <pod-name>
kubectl logs <pod-name>4. CI/CD pipeline failing
- Check Docker Hub credentials
- Verify Dockerfile syntax
- Ensure all files are committed
- Person 1: Application development and AI integration
- Person 2: Containerization and CI/CD setup
- Person 3: Kubernetes deployment and documentation
This project is for educational purposes as part of the DevOps Capstone project.
- Google Gemini API for AI capabilities
- Gradio for the low-code UI framework
- IBM Docker/Kubernetes course for guidance
For questions or issues, please open an issue on GitHub. #Done by Dev-Api-Org