MO
mohitjain2306/Bus-Distance-Calculator
A practical tool for predicting how far your bus can travel based on current conditions.
๐ Bus Distance Calculator
ML-Powered Bus Range Prediction & Fleet Efficiency System
A web application that predicts how far a bus can travel based on fuel level, load, speed, temperature, and route type โ with efficiency insights for fleet management.
Live Demo: https://bus-distance.streamlit.app/
What It Does
Enter details like:
Fuel: 75%, Load: 1200kg, Speed: 65kmph, Temp: 22ยฐC, Route: Highway
And the system will:
- Predict the distance the bus can travel
- Score the fuel efficiency
- Analyze load and temperature impact
- Give route optimization recommendations
- Support bulk fleet analysis via CSV upload
Tech Stack
| Layer | Technology |
|---|---|
| App | Python, Streamlit |
| ML Model | Scikit-learn, Random Forest |
| Containerization | Docker, Docker Compose |
| Reverse Proxy | Nginx |
| CI/CD | GitHub Actions |
| Deployment | Streamlit Cloud |
Project Structure
Bus-Distance-Calculator/
โโโ .github/
โ โโโ workflows/
โ โโโ docker-build.yml # CI/CD pipeline
โโโ backend/
โ โโโ bus.py # main Streamlit app
โ โโโ main.py # ML training logic
โ โโโ fuel_dataset.csv # training dataset
โ โโโ requirements.txt # Python dependencies
โ โโโ Dockerfile # containerises the app
โโโ frontend/
โ โโโ nginx.conf # reverse proxy config
โโโ scripts/
โ โโโ deploy.sh # one-command local deploy
โโโ docker-compose.yml
โโโ .gitignore
โโโ README.md
Run Locally
Without Docker
git clone https://github.com/mohitjain2306/Bus-Distance-Calculator.git
cd Bus-Distance-Calculator
pip install -r backend/requirements.txt
cd backend
streamlit run bus.pyThen open http://localhost:8501
With Docker
git clone https://github.com/mohitjain2306/Bus-Distance-Calculator.git
cd Bus-Distance-Calculator
docker compose up --build- Frontend (nginx): http://localhost:80
- Backend (streamlit): http://localhost:8501
DevOps Setup
Docker
The backend is containerized using Docker. The frontend is served using Nginx.
docker build -t bus-distance-calculator ./backend
docker run -p 8501:8501 bus-distance-calculatorDocker Compose
Runs both frontend and backend together with one command:
docker compose upCI/CD Pipeline
Every push to main automatically:
- Builds the Docker image
- Pushes it to DockerHub
DockerHub image: mohitjain2306/bus-distance-calculator
Input Parameters
| Parameter | Description | Example |
|---|---|---|
| Fuel Level | Current fuel percentage | 75% |
| Vehicle Load | Total load in kilograms | 1200 kg |
| Speed | Average speed | 65 kmph |
| Temperature | Outside temperature | 22ยฐC |
| Route Type | Highway, Urban, or Rural | Highway |
Features
- Distance Prediction โ ML model predicts range based on current conditions
- Efficiency Scoring โ rates fuel efficiency and highlights issues
- Load Impact Analysis โ shows how weight affects performance
- Route Comparison โ highway vs urban vs rural performance
- Bulk Fleet Analysis โ upload CSV to analyse entire fleet at once
Author
Mohit Jain
- GitHub: @mohitjain2306
- Live App: bus-distance.streamlit.app
- DockerHub: mohitjain2306
On this page
Languages
Python98.0%Shell1.2%Dockerfile0.8%
Contributors
Created July 27, 2025
Updated March 13, 2026