Jing997 commited on
Commit
c32b737
Β·
verified Β·
1 Parent(s): ca6e724

Initial Commit

Browse files
Files changed (7) hide show
  1. Dockerfile +8 -13
  2. LICENSE +21 -0
  3. README.md +87 -15
  4. app.py +35 -0
  5. config.toml +17 -0
  6. huggingface-metadata.yaml +8 -0
  7. requirements.txt +11 -3
Dockerfile CHANGED
@@ -2,20 +2,15 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- curl \
8
- software-properties-common \
9
- git \
10
- && rm -rf /var/lib/apt/lists/*
11
 
12
- COPY requirements.txt ./
13
- COPY src/ ./src/
14
-
15
- RUN pip3 install -r requirements.txt
16
 
 
17
  EXPOSE 8501
18
 
19
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
20
-
21
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # Copy requirements and install dependencies
6
+ COPY requirements.txt .
7
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
 
8
 
9
+ # Copy the application code
10
+ COPY . .
 
 
11
 
12
+ # Expose the Streamlit port
13
  EXPOSE 8501
14
 
15
+ # Command to run the application
16
+ CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=8501"]
 
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jhwong19
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,20 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- title: DeliveryRouteOptimisation
3
- emoji: πŸš€
4
- colorFrom: red
5
- colorTo: red
6
- sdk: docker
7
- app_port: 8501
8
- tags:
9
- - streamlit
10
- pinned: false
11
- short_description: Delivery Route Optimisation for parcel delivery schedules
12
- license: mit
 
 
 
 
 
 
 
 
 
 
 
 
13
  ---
14
 
15
- # Welcome to Streamlit!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- Edit `/src/streamlit_app.py` to customize this app to your heart's desire. :heart:
18
 
19
- If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
20
- forums](https://discuss.streamlit.io).
 
1
+ # Project: Delivery Route Optimization
2
+
3
+ ![Delivery Route Network](img/delivery-route-network.jpg)
4
+
5
+ This project is a **Delivery Route Optimization** tool built using Streamlit. It aims to optimize delivery routes for a fleet of vehicles while considering constraints such as delivery time windows, vehicle capacity, and traffic conditions.
6
+
7
+
8
+ ### Key Features
9
+ 1. **Route Optimization**:
10
+ - Solve the **Vehicle Routing Problem (VRP)** to determine the most efficient routes for a fleet of vehicles.
11
+ - Incorporate constraints like:
12
+ - Delivery time windows.
13
+ - Vehicle capacity.
14
+ - Traffic conditions.
15
+
16
+ 2. **Map Visualization**:
17
+ - Display optimized routes on an interactive map using **Folium**.
18
+ - Highlight delivery stops, start and end points, and route distances.
19
+
20
+ 3. **Calendar View**:
21
+ - Provide a calendar-based schedule for deliveries.
22
+ - Allow users to view and manage delivery schedules for specific days or weeks.
23
+
24
+ 4. **Real-Time Updates**:
25
+ - Enable real-time updates for route changes due to unexpected events (e.g., traffic congestion, vehicle breakdowns).
26
+ - Re-optimize routes dynamically and update the map and calendar views.
27
+
28
+ ### Tools and Technologies
29
+ - **Python**: Core programming language for optimization and application logic.
30
+ - **Google OR-Tools**: Solve the Vehicle Routing Problem (VRP) with constraints.
31
+ - **Streamlit**: Build an interactive web application for route visualization and schedule management.
32
+ - **Folium**: Create interactive maps for route visualization.
33
+ - **Synthetic Data**: Integrate real-time traffic data for dynamic route adjustments.
34
+
35
  ---
36
+
37
+ ## Project Structure
38
+
39
+ ```
40
+ streamlit-app-template
41
+ β”œβ”€β”€ src
42
+ β”‚ β”œβ”€β”€ app.py # Main entry point of the Streamlit application
43
+ β”‚ β”œβ”€β”€ components # Directory for reusable UI components
44
+ β”‚ β”‚ └── __init__.py
45
+ β”‚ β”œβ”€β”€ pages # Directory for different pages of the application
46
+ β”‚ β”‚ └── __init__.py
47
+ β”‚ β”œβ”€β”€ utils # Directory for utility functions
48
+ β”‚ β”‚ └── __init__.py
49
+ β”œβ”€β”€ requirements.txt # List of dependencies for the application
50
+ β”œβ”€β”€ .streamlit # Configuration settings for Streamlit
51
+ β”‚ β”œβ”€β”€ config.toml
52
+ β”œβ”€β”€ img # Folder for storing images
53
+ β”‚ └── delivery_route_network.png
54
+ β”œβ”€β”€ .gitignore # Files and directories to ignore in Git
55
+ β”œβ”€β”€ README.md # Documentation for the project
56
+ └── LICENSE # Licensing information
57
+ ```
58
+
59
  ---
60
 
61
+ ## Installation
62
+
63
+ To get started with this Streamlit application template, follow these steps:
64
+
65
+ 1. Clone the repository:
66
+ ```
67
+ git clone https://github.com/yourusername/streamlit-app-template.git
68
+ cd streamlit-app-template
69
+ ```
70
+
71
+ 2. Create a virtual environment (optional but recommended):
72
+ ```
73
+ python -m venv venv
74
+ source venv/bin/activate # On macOS/Linux
75
+ venv\Scripts\activate # On Windows
76
+ ```
77
+
78
+ 3. Install the required dependencies:
79
+ ```
80
+ pip install -r requirements.txt
81
+ ```
82
+
83
+ 4. Run the Streamlit application:
84
+ ```
85
+ streamlit run src/app.py
86
+ ```
87
+
88
+ ---
89
 
90
+ ## License
91
 
92
+ This project is licensed under the MIT License. See the LICENSE file for more details.
 
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Main entry point of the Streamlit application
2
+
3
+ import streamlit as st
4
+ import sys
5
+ from pathlib import Path
6
+
7
+ # Import all pages from the pages module
8
+ from src.pages import home_page, about_page, contact_page, map_page, optimize_page
9
+
10
+ def main():
11
+ st.set_page_config(
12
+ page_title="Delivery Route Optimization",
13
+ page_icon="🚚",
14
+ layout="wide",
15
+ initial_sidebar_state="expanded",
16
+ )
17
+
18
+ st.sidebar.title("Navigation")
19
+
20
+ # Sidebar navigation
21
+ pages = {
22
+ "Home": home_page,
23
+ "Map": map_page,
24
+ "Optimizer": optimize_page, # Add the new page
25
+ "About": about_page,
26
+ "Contact": contact_page
27
+ }
28
+
29
+ selection = st.sidebar.radio("Go to", list(pages.keys()))
30
+
31
+ # Render the selected page
32
+ pages[selection]()
33
+
34
+ if __name__ == "__main__":
35
+ main()
config.toml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [general]
2
+ email = "[email protected]"
3
+ # The email address for the Streamlit sharing service.
4
+
5
+ [server]
6
+ headless = true
7
+ port = 8501
8
+ enableCORS = false
9
+ # Configuration for the server, including running in headless mode and setting the port.
10
+
11
+ [theme]
12
+ primaryColor = "#F39C12"
13
+ backgroundColor = "#FFFFFF"
14
+ secondaryBackgroundColor = "#F0F0F0"
15
+ textColor = "#000000"
16
+ font = "sans serif"
17
+ # Theme settings for the Streamlit application, including colors and font.
huggingface-metadata.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # File: .github/huggingface-metadata.yaml
2
+ title: Streamlit Scheduler App
3
+ emoji: 🚚
4
+ colorFrom: indigo
5
+ colorTo: blue
6
+ sdk: docker
7
+ app_port: 8501
8
+ pinned: false
requirements.txt CHANGED
@@ -1,3 +1,11 @@
1
- altair
2
- pandas
3
- streamlit
 
 
 
 
 
 
 
 
 
1
+ streamlit>=1.24.0
2
+ pandas>=1.5.0
3
+ numpy>=1.23.0
4
+ plotly>=5.13.0
5
+ folium>=0.14.0
6
+ streamlit-folium>=0.11.0
7
+ requests>=2.28.0
8
+ python-dotenv>=1.0.0
9
+ ortools>=9.6.0
10
+ geopy
11
+ matplotlib