FastAPI-based Machine Learning app to predict Electric Vehicle efficiency (High/Low) EV parameters.
3.6K
β‘ EV Efficiency Predictor β Dockerized FastAPI ML App
This project is a Machine Learningβpowered Electric Vehicle (EV) Efficiency Predictor, built using FastAPI, Scikit-learn, and Docker.
It predicts whether an electric vehicle configuration will have High or Low efficiency based on multiple technical, performance, and safety parameters.
The application includes:
A trained ML classification model
A FastAPI backend API
A modern HTML frontend UI
Full Docker support for easy deployment
π§ Features
π Predict EV efficiency (High / Low)
β‘ Uses real EV parameters (battery, range, charging, speed, safety)
π FastAPI backend with CORS enabled
π Scikit-learn trained classifier
π Interactive web UI
π³ Fully Dockerized (production-ready)
π οΈ Tech Stack
Backend: FastAPI, Pydantic
ML: Scikit-learn, Pandas, Joblib
Frontend: HTML/CSS/JavaScript
Deployment: Docker, Uvicorn
Python Version: 3.11
π Project Structure (Important for Users)
.
βββ api/
β βββ api.py # FastAPI app
βββ model/
β βββ ev_efficiency_classifier.pkl
βββ UI/
β βββ index.html # Frontend UI
βββ requirements.txt
βββ Dockerfile
βββ README.md
βΆοΈ How to Use This Image (Docker Commands) πΉ 1. Pull the Image from Docker Hub docker pull musheer/ev-efficiency-predictor
πΉ 2. Run the Container docker run -d -p 8000:8000 musheer/ev-efficiency-predictor
πΉ 3. Open in Browser
Web UI: π http://localhost:8000β
API Docs (Swagger): π http://localhost:8000/docsβ
π API Usage Endpoint POST /predict
Example JSON Payload { "manufacturer": "Tesla", "model": "Model 3", "type": "Sedan", "drive_type": "RWD", "fuel_type": "Electric", "color": "White", "fast_charging": "Yes", "country": "USA", "city": "San Francisco", "battery_kwh": 60, "range_km": 450, "charging_time_hr": 1.2, "release_year": 2023, "seats": 5, "acceleration_0_100_kmph": 5.8, "top_speed_kmph": 225, "warranty_years": 8, "cargo_space_liters": 425, "safety_rating": 5 }
Response { "prediction": 1 }
1 β High Efficiency
0 β Low Efficiency
π³ Dockerfile Used FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["uvicorn", "api.api:app", "--host", "0.0.0.0", "--port", "8000"]
π― Ideal For
Machine Learning Internships
FastAPI + ML demos
Docker & DevOps practice
Resume & portfolio projects
College & capstone submissions
Content type
Image
Digest
sha256:b6a6f44e3β¦
Size
194.7 MB
Last updated
8 months ago
docker pull mohdmusheer/ev-efficiency-predictor