A simple machine learning project that can identify electric cars from photos and predict their driving range. Built with modern MLOps practices for easy deployment and maintenance.
Reports: https://docs.google.com/document/d/17qlmMI8Ot_4nT88Cjn9gaF8pYKDIK8VX0XQatznHP2U/edit?usp=sharing
Project Front End: https://finalprojectcpe393.streamlit.app/
This MLOps platform combines computer vision and predictive modeling to analyze electric vehicles. Built with a modern tech stack including Streamlit, Apache Kafka, AWS RDS, and containerized with Docker, it demonstrates end-to-end machine learning operations from data ingestion to model deployment. The system features continuous integration/deployment through GitHub Actions and monitors performance with MLflow, making it both a practical tool and a showcase of MLOps best practices.
πΈ Car Recognition: Upload a photo of an electric car and get the make/model
π Range Prediction: Enter car details and get predicted driving range
π₯οΈ Easy Web Interface: Simple web app to use both features
π€ Real-Time Data Ingsetion with Apache kafka and AWS RDS
π€ Automated Everything: Automatic testing, building, and deployment
What each part does:
Web Interface: Where users interact (like a website)
API Server: Handles requests and runs AI models
AI Models: One recognizes cars, one predicts range
Kafka: real-time data ingestion
Database: Stores car data
Automation: Keeps everything running smoothly
π Main Files
βββ app.py # The website users see
βββ model_server.py # The brain that runs AI models
βββ requirements.txt # List of needed software
βββ Dockerfile.model # Instructions to package the AI brain
βββ Dockerfile.app # Instructions to package the website
π AI Models
βββ ml_model/ # Trained AI models stored here
βββ notebooks/ # Where we experiment and clean data
π Automation
βββ .github/workflows/ # Automatic testing and deployment
βββ airflow/ # Scheduled tasks (like model updates)
βββ tests/ # Code that checks if everything works
π Data
βββ data/ # Electric vehicle information
βββ kafka/ # Real-time data processing (advanced)
What You Need
Docker (software that packages applications)
Git (for downloading code)
Step 1: Clone the repository:
git clone https://github.com/nutkung1/FinalProjectCPE393.git
cd FinalProjectCPE393
Step 2: Download Library
pip install -r requirements.txt
Step 3: Start Everything Apache Kafka
cd kafka
docker-compose start -f docker-compose.kafka.yaml up
Airflow Docker-compose (Airflow + MLFlow)
docker-compose start -f docker-compose.airflow.yaml up
BackEnd
python model_server.py
ngrok 8000
Step 4: Use the App
Open your browser to http://localhost:8501 or https://finalprojectcpe393.streamlit.app/
Upload a car photo or enter car details
Get instant predictions!
π§ What the AI Can Do
-
Recognize Cars from Photos Send a photo, get back:
-
Predict Driving Range Enter car details, get range prediction:
The project automatically:
β Tests all code before deployment
β Checks code quality and style
β Builds and packages everything correctly
β Reports any problems immediately
Accuracy: 95 %
Speed: Identifies cars in under 1 second
Average Error: Β±15 miles
Reliability: Works for 95% of electric vehicles
MAE: 0.54
What Happens When You Update Code:
Code Check: Automatically tests your changes
Quality Check: Makes sure code follows best practices
Build: Creates new versions of the app
Deploy: Updates the live application
Monitor: Watches for any problems
Scheduled Tasks:
Daily: Check for new car data
Weekly: Retrain models with the latest information
Monthly: Performance reports
π οΈ For Developers
Local Development
Adding New Features
Make changes to the code
Run tests: pytest
Push to GitHub
Automatic deployment handles the rest!
Simple but Powerful:
Each part does one job well Easy to fix problems Can handle lots of users Automatically stays up-to-date Benefits for Users:
Fast predictions Always available Accurate results Easy to use Benefits for Developers:
Easy to maintain Automatic testing Quick deployments Clear code organization
High Availability: App stays running even if one part fails
Auto-Scaling: Handles more users automatically
Monitoring: Alerts if anything goes wrong
Security: Protects user data and prevents attacks
Backup: Regular data backups for safety