Spaces:
No application file
No application file
File size: 2,947 Bytes
80dbe44 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | ---
title: Transportation AI System
emoji: 🚚
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
license: mit
---
An AI-powered system to predict optimal transportation modes for logistics and supply chain management, deployable via Docker.
## Quick Start with Docker
### Option 1: Frontend Only (Gradio UI)
```bash
# Build and run frontend only
docker build -t transportation-ai .
docker run -p 7860:7860 transportation-ai
```
### Option 2: Backend + Frontend (Recommended)
```bash
# Run both services with docker-compose
docker-compose up -d
```
### Option 3: All-in-one Container
```bash
# Run both services in single container
docker-compose --profile all-in-one up
```
## Development Setup
### Local Development
```bash
# Install dependencies
pip install -r requirements.txt
# Start backend API
python -m src.main
# Start frontend (in another terminal)
python app.py
```
### Windows Users
```batch
# Use the batch script
start.bat
```
### Linux/Mac Users
```bash
# Use the shell script
chmod +x start.sh
./start.sh
```
## Features
### Transportation Prediction
- Predict optimal shipping methods (Air, Air Charter, Ocean, Truck)
- Display confidence scores and alternatives
- Interactive probability distribution charts
- Automatic weight and cost estimation
### AI Chat Assistant
- Chat about transportation and logistics
- Get insights on shipping methods
- Compare different transportation modes
- Cost analysis and optimization tips
## How to Use
1. **Prediction Tab**: Enter shipment details to get AI recommendations
2. **Chat Tab**: Ask questions about transportation and logistics
## Docker Services
### Backend API (Port 3454)
- FastAPI server với prediction endpoints
- Loads models from Hugging Face
- REST API documentation tại `/docs`
### Frontend UI (Port 7860)
- Gradio interface
- Real-time streaming chat
- Interactive prediction forms
## Technical Details
- **Model**: XGBoost trained on logistics data từ Hugging Face
- **Input Features**: Project code, country, price, vendor, weight, etc.
- **Output**: Transportation mode with confidence score
- **Framework**: FastAPI + Gradio + scikit-learn + XGBoost
- **Deployment**: Docker + Docker Compose
## Sample Questions for Chat
- "Compare Air vs Ocean transportation"
- "What affects shipping costs?"
- "When should I use truck transport?"
- "Optimize logistics for my company"
## Configuration
### Environment Variables
```env
GEMINI_API_KEY=your_gemini_api_key
ACCESS=your_huggingface_token
API_BASE_URL=http://localhost:3454/api
```
### Docker Compose Services
- `backend`: FastAPI server (port 3454)
- `frontend`: Gradio UI (port 7860)
- `app`: All-in-one service (both ports)
## API Endpoints
- `GET /` - API status
- `POST /api/predict-transportation` - Prediction
- `GET /api/transportation-options` - Available options
- `POST /api/chat` - AI chat (streaming)
Built with Docker, FastAPI, Gradio and XGBoost
|