........
Browse files- DEPLOYMENT.md +0 -181
- README.md +7 -2
DEPLOYMENT.md
DELETED
|
@@ -1,181 +0,0 @@
|
|
| 1 |
-
# Hugging Face Spaces Deployment Guide
|
| 2 |
-
|
| 3 |
-
## Prerequisites
|
| 4 |
-
|
| 5 |
-
1. **Hugging Face Account**: Create an account at [huggingface.co](https://huggingface.co)
|
| 6 |
-
2. **Git**: Ensure Git is installed on your system
|
| 7 |
-
3. **Git LFS**: Install Git Large File Storage for handling large files
|
| 8 |
-
|
| 9 |
-
## Step-by-Step Deployment
|
| 10 |
-
|
| 11 |
-
### 1. Create a New Space
|
| 12 |
-
|
| 13 |
-
1. Go to [Hugging Face Spaces](https://huggingface.co/spaces)
|
| 14 |
-
2. Click "Create new Space"
|
| 15 |
-
3. Fill in the details:
|
| 16 |
-
- **Space name**: `rainwater-harvesting-calculator` (or your preferred name)
|
| 17 |
-
- **License**: MIT
|
| 18 |
-
- **SDK**: Docker
|
| 19 |
-
- **Hardware**: CPU basic (free tier)
|
| 20 |
-
- **Visibility**: Public (or Private if you prefer)
|
| 21 |
-
|
| 22 |
-
### 2. Clone the Repository
|
| 23 |
-
|
| 24 |
-
```bash
|
| 25 |
-
git clone https://huggingface.co/spaces/YOUR_USERNAME/rainwater-harvesting-calculator
|
| 26 |
-
cd rainwater-harvesting-calculator
|
| 27 |
-
```
|
| 28 |
-
|
| 29 |
-
### 3. Copy Your Application Files
|
| 30 |
-
|
| 31 |
-
Copy all the files from your current project to the cloned repository:
|
| 32 |
-
|
| 33 |
-
```bash
|
| 34 |
-
# Copy all files except .git directory
|
| 35 |
-
cp -r /path/to/your/sihmicro/* ./
|
| 36 |
-
```
|
| 37 |
-
|
| 38 |
-
Files to include:
|
| 39 |
-
- `app.py`
|
| 40 |
-
- `RoofTopCalculation.py`
|
| 41 |
-
- `RainFallModel.py`
|
| 42 |
-
- `requirements.txt`
|
| 43 |
-
- `Dockerfile`
|
| 44 |
-
- `README.md`
|
| 45 |
-
- `.gitignore`
|
| 46 |
-
|
| 47 |
-
### 4. Commit and Push
|
| 48 |
-
|
| 49 |
-
```bash
|
| 50 |
-
git add .
|
| 51 |
-
git commit -m "Initial deployment of Rainwater Harvesting Calculator"
|
| 52 |
-
git push
|
| 53 |
-
```
|
| 54 |
-
|
| 55 |
-
### 5. Monitor Deployment
|
| 56 |
-
|
| 57 |
-
1. Go to your Space page on Hugging Face
|
| 58 |
-
2. Check the "Build logs" tab to monitor the deployment process
|
| 59 |
-
3. Wait for the build to complete (usually 5-10 minutes)
|
| 60 |
-
|
| 61 |
-
## Alternative: Direct Upload
|
| 62 |
-
|
| 63 |
-
If you prefer not to use Git:
|
| 64 |
-
|
| 65 |
-
1. Create the Space as described above
|
| 66 |
-
2. Use the web interface to upload files:
|
| 67 |
-
- Click "Files" tab in your Space
|
| 68 |
-
- Drag and drop or upload each file
|
| 69 |
-
- Commit changes with a meaningful message
|
| 70 |
-
|
| 71 |
-
## Configuration Details
|
| 72 |
-
|
| 73 |
-
### README.md Front Matter
|
| 74 |
-
The YAML front matter in README.md configures your Space:
|
| 75 |
-
|
| 76 |
-
```yaml
|
| 77 |
-
---
|
| 78 |
-
title: Rainwater Harvesting Calculator
|
| 79 |
-
emoji: 💧
|
| 80 |
-
colorFrom: blue
|
| 81 |
-
colorTo: green
|
| 82 |
-
sdk: docker
|
| 83 |
-
pinned: false
|
| 84 |
-
license: mit
|
| 85 |
-
app_port: 7860
|
| 86 |
-
---
|
| 87 |
-
```
|
| 88 |
-
|
| 89 |
-
### Key Configuration Points
|
| 90 |
-
|
| 91 |
-
- **SDK**: Set to `docker` (not `gradio` or `streamlit`)
|
| 92 |
-
- **app_port**: Must be `7860` for Hugging Face Spaces
|
| 93 |
-
- **Docker**: Uses your custom Dockerfile for deployment
|
| 94 |
-
|
| 95 |
-
## Testing Your Deployment
|
| 96 |
-
|
| 97 |
-
Once deployed, test your API endpoints:
|
| 98 |
-
|
| 99 |
-
### Health Check
|
| 100 |
-
```bash
|
| 101 |
-
curl https://YOUR_USERNAME-rainwater-harvesting-calculator.hf.space/health
|
| 102 |
-
```
|
| 103 |
-
|
| 104 |
-
### API Test
|
| 105 |
-
```bash
|
| 106 |
-
curl -X POST https://YOUR_USERNAME-rainwater-harvesting-calculator.hf.space/api/roofTopCalculation \
|
| 107 |
-
-H "Content-Type: application/json" \
|
| 108 |
-
-d '{
|
| 109 |
-
"location": "Chennai",
|
| 110 |
-
"roof_area": 150,
|
| 111 |
-
"open_space": 100,
|
| 112 |
-
"roof_type": "concrete",
|
| 113 |
-
"dwellers": 4
|
| 114 |
-
}'
|
| 115 |
-
```
|
| 116 |
-
|
| 117 |
-
## Troubleshooting
|
| 118 |
-
|
| 119 |
-
### Common Issues
|
| 120 |
-
|
| 121 |
-
1. **Build Failure**: Check build logs for missing dependencies
|
| 122 |
-
2. **Permission Errors**: Ensure cache directories have proper permissions
|
| 123 |
-
3. **Port Issues**: Verify app runs on port 7860
|
| 124 |
-
4. **Memory Issues**: Consider upgrading to CPU upgrade if needed
|
| 125 |
-
|
| 126 |
-
### Debug Steps
|
| 127 |
-
|
| 128 |
-
1. Check build logs in the Space interface
|
| 129 |
-
2. Verify all required files are present
|
| 130 |
-
3. Test locally with Docker before deploying
|
| 131 |
-
4. Review requirements.txt for missing packages
|
| 132 |
-
|
| 133 |
-
### Local Testing Before Deployment
|
| 134 |
-
|
| 135 |
-
```bash
|
| 136 |
-
# Build and test locally
|
| 137 |
-
docker build -t rainwater-app .
|
| 138 |
-
docker run -p 7860:7860 rainwater-app
|
| 139 |
-
|
| 140 |
-
# Test the endpoints
|
| 141 |
-
curl http://localhost:7860/health
|
| 142 |
-
```
|
| 143 |
-
|
| 144 |
-
## Optimization Tips
|
| 145 |
-
|
| 146 |
-
1. **Dependencies**: Keep requirements.txt minimal
|
| 147 |
-
2. **Caching**: Utilize Hugging Face Hub caching effectively
|
| 148 |
-
3. **Error Handling**: Ensure robust fallback mechanisms
|
| 149 |
-
4. **Logging**: Use appropriate logging levels for production
|
| 150 |
-
|
| 151 |
-
## Monitoring and Maintenance
|
| 152 |
-
|
| 153 |
-
1. **Usage Analytics**: Monitor via Hugging Face Space analytics
|
| 154 |
-
2. **Error Logs**: Check application logs in the Space interface
|
| 155 |
-
3. **Updates**: Use Git to push updates and trigger rebuilds
|
| 156 |
-
4. **Performance**: Monitor response times and consider hardware upgrades
|
| 157 |
-
|
| 158 |
-
## Security Considerations
|
| 159 |
-
|
| 160 |
-
1. **API Keys**: Use Hugging Face Secrets for sensitive data
|
| 161 |
-
2. **Input Validation**: Ensure proper input sanitization
|
| 162 |
-
3. **Rate Limiting**: Consider implementing rate limiting for production use
|
| 163 |
-
4. **HTTPS**: Hugging Face Spaces automatically provide HTTPS
|
| 164 |
-
|
| 165 |
-
## Next Steps
|
| 166 |
-
|
| 167 |
-
After successful deployment:
|
| 168 |
-
|
| 169 |
-
1. Share your Space URL with users
|
| 170 |
-
2. Add usage examples to your README
|
| 171 |
-
3. Consider adding a simple web interface using FastAPI's automatic docs
|
| 172 |
-
4. Monitor usage and optimize based on user feedback
|
| 173 |
-
|
| 174 |
-
## Support
|
| 175 |
-
|
| 176 |
-
- [Hugging Face Spaces Documentation](https://huggingface.co/docs/hub/spaces)
|
| 177 |
-
- [Docker SDK Guide](https://huggingface.co/docs/hub/spaces-sdks-docker)
|
| 178 |
-
- [Community Forum](https://discuss.huggingface.co/)
|
| 179 |
-
|
| 180 |
-
Your Rainwater Harvesting Calculator will be available at:
|
| 181 |
-
`https://YOUR_USERNAME-rainwater-harvesting-calculator.hf.space`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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ensive API for calculating rainwater harvesting potential, structure recommendations, and cost analysis based on location, roof area, and other parameters.
|
| 10 |
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Rainwater Harvesting Calculator
|
| 3 |
+
colorFrom: blue
|
| 4 |
+
colorTo: green
|
| 5 |
+
sdk: docker
|
| 6 |
+
app_file: app.py
|
| 7 |
+
pinned: false
|
| 8 |
license: mit
|
| 9 |
app_port: 7860
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Rainwater Harvesting Calculator
|
| 13 |
|
| 14 |
A comprehensive API for calculating rainwater harvesting potential, structure recommendations, and cost analysis based on location, roof area, and other parameters.
|
| 15 |
|