File size: 4,712 Bytes
80f87f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# πŸš€ HDD Solution Predictor - Deployment Package

Ready-to-deploy package for the HDD Solution Predictor application.

## πŸ“¦ Package Contents

### **Application Files**
- `app.py` - Main Streamlit application (recommended)
- `mobile_app.py` - Mobile-optimized version
- `requirements.txt` - Python dependencies

### **Model Files**
- `decision_tree_model.pkl` - Trained Decision Tree model (100% accuracy)
- `dt_soil_encoder.pkl` - Soil type label encoder
- `dt_water_encoder.pkl` - Water table label encoder  
- `dt_solution_encoder.pkl` - Solution label encoder

### **Assets**
- `logo2.e8c5ff97.png` - MEA (Metropolitan Electricity Authority) logo
- `HDD_result.xlsx` - Training dataset

### **Documentation**
- `README.md` - This deployment guide

## πŸ”§ Quick Deployment

### **1. Install Dependencies**
```bash
pip install -r requirements.txt
```

### **2. Run Application**
```bash
# Main application (recommended)
streamlit run app.py

# Or mobile version
streamlit run mobile_app.py
```

### **3. Access Application**
- Local: `http://localhost:8501`
- Network: Will be shown in terminal

## 🌐 Deployment Options

### **Option A: Local Development**
```bash
git clone <repository>
cd deploy
pip install -r requirements.txt
streamlit run app.py
```

### **Option B: Streamlit Cloud**
1. Upload all files to GitHub repository
2. Connect to Streamlit Cloud
3. Deploy from `deploy/app.py`

### **Option C: Docker Deployment**
Create `Dockerfile`:
```dockerfile
FROM python:3.11-slim

WORKDIR /app
COPY . .

RUN pip install -r requirements.txt

EXPOSE 8501

CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
```

### **Option D: Heroku Deployment**
Create `Procfile`:
```
web: streamlit run app.py --server.port=$PORT --server.address=0.0.0.0
```

## πŸ“Š Application Features

### **Core Functionality**
- **Input Parameters**: Pipe diameter, soil type, water table
- **ML Prediction**: Decision Tree with 100% training accuracy
- **Solution Types**: A, B, C, D, E (different protection levels)

### **Technical Specifications**
- **Framework**: Streamlit
- **ML Model**: Scikit-learn Decision Tree
- **Design**: Canva-style responsive UI
- **Branding**: MEA institutional logo

### **Supported Solutions**
- **Solution A**: Enhanced Protection (Sheetpile + Trench + Grouting)
- **Solution B**: Maximum Protection (+ Casing)
- **Solution C**: Moderate Protection (Sheetpile + Trench)
- **Solution D**: Basic Protection (Grouting Only)
- **Solution E**: Minimal Intervention (No Additional Measures)

## πŸ” System Requirements

### **Python Version**
- Python 3.8 or higher (recommended: 3.11)

### **Dependencies**
- streamlit
- pandas
- numpy
- scikit-learn
- joblib
- plotly
- openpyxl
- Pillow

### **Resources**
- **RAM**: Minimum 512MB, Recommended 1GB
- **Storage**: ~50MB for all files
- **Network**: Internet connection for initial setup

## πŸ”§ Configuration

### **Environment Variables** (Optional)
```bash
export STREAMLIT_SERVER_PORT=8501
export STREAMLIT_SERVER_ADDRESS=0.0.0.0
```

### **Streamlit Config** (Create `.streamlit/config.toml`)
```toml
[server]
port = 8501
address = "0.0.0.0"

[theme]
primaryColor = "#6c5ce7"
backgroundColor = "#ffffff"
secondaryBackgroundColor = "#f0f2f6"
```

## 🚨 Troubleshooting

### **Model Loading Issues**
- Ensure all `.pkl` files are in the same directory
- Check Python/scikit-learn version compatibility

### **Logo Not Displaying**
- Verify `logo2.e8c5ff97.png` exists in directory
- App will show MEA text fallback if logo missing

### **Port Already in Use**
```bash
streamlit run app.py --server.port=8502
```

### **Permission Issues**
```bash
chmod +x app.py
pip install --user -r requirements.txt
```

## πŸ“± Mobile Access

The application is fully responsive and works on:
- βœ… Desktop browsers
- βœ… Mobile phones  
- βœ… Tablets
- βœ… Touch devices

## πŸ”’ Security Notes

- Application runs locally by default
- No external API calls
- Model predictions processed locally
- Training data included for reference only

## πŸ“ž Support

### **Common Issues**
1. **Dependencies**: Run `pip install -r requirements.txt`
2. **Port conflicts**: Use different port with `--server.port=XXXX`
3. **File paths**: Ensure all files are in same directory

### **Performance**
- **Model loading**: ~1-2 seconds on first run
- **Predictions**: Instant (<100ms)
- **UI rendering**: <1 second

---

## 🎯 Ready to Deploy!

1. **Install requirements**: `pip install -r requirements.txt`
2. **Run application**: `streamlit run app.py`
3. **Open browser**: Navigate to displayed URL
4. **Start predicting**: Enter parameters and get solutions!

**🏒 Powered by MEA (Metropolitan Electricity Authority)**