Spaces:
Sleeping
Sleeping
| # π 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)** |