Spaces:
Runtime error
Runtime error
File size: 5,615 Bytes
3f42a6f |
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 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# π¦ Hugging Face Deployment - File Checklist
## β
Files Created for Deployment
### Core Application Files
- β
**app.py** - Gradio interface with OCR processing
- β
**requirements.txt** - Python dependencies (Gradio + eDOCr2)
- β
**packages.txt** - System dependencies (Tesseract, Poppler)
- β
**README.md** - Space description with YAML frontmatter
- β
**.gitattributes** - Git LFS configuration for model files
### Documentation
- β
**DEPLOYMENT.md** - Complete deployment guide
- β
**run_local.bat** - Windows quick start script
- β
**run_local.sh** - Linux/Mac quick start script
### Required Folders
- β
**edocr2/** - Main package (already exists)
- β
**edocr2/tools/** - OCR pipelines
- β
**edocr2/keras_ocr/** - OCR models
- β οΈ **edocr2/models/** - Model files (MUST DOWNLOAD)
- β
**tests/test_samples/** - Example drawings (optional)
## π΄ IMPORTANT: Download Model Files
Before deploying, download these 4 files and place in `edocr2/models/`:
1. **recognizer_gdts.keras** (67.2 MB)
2. **recognizer_gdts.txt** (85 bytes)
3. **recognizer_dimensions_2.keras** (67.2 MB)
4. **recognizer_dimensions_2.txt** (42 bytes)
**Download from:** https://github.com/javvi51/edocr2/releases/tag/v1.0.0
## π Pre-Deployment Checklist
### Local Testing
- [ ] Models downloaded and placed in `edocr2/models/`
- [ ] Run `python app.py` locally
- [ ] Test with sample images
- [ ] Verify all outputs (image, JSON, ZIP)
### Hugging Face Setup
- [ ] Hugging Face account created
- [ ] Git LFS installed
- [ ] New Space created on Hugging Face
### File Verification
- [ ] All files present in folder
- [ ] Model files in correct location
- [ ] `.gitattributes` configured for LFS
- [ ] `README.md` has YAML frontmatter
## π Deployment Steps
### 1. Download Models
**Windows PowerShell:**
```powershell
cd edocr2-main
New-Item -ItemType Directory -Force -Path edocr2\models
cd edocr2\models
Invoke-WebRequest -Uri "https://github.com/javvi51/edocr2/releases/download/v1.0.0/recognizer_gdts.keras" -OutFile "recognizer_gdts.keras"
Invoke-WebRequest -Uri "https://github.com/javvi51/edocr2/releases/download/v1.0.0/recognizer_gdts.txt" -OutFile "recognizer_gdts.txt"
Invoke-WebRequest -Uri "https://github.com/javvi51/edocr2/releases/download/v1.0.0/recognizer_dimensions_2.keras" -OutFile "recognizer_dimensions_2.keras"
Invoke-WebRequest -Uri "https://github.com/javvi51/edocr2/releases/download/v1.0.0/recognizer_dimensions_2.txt" -OutFile "recognizer_dimensions_2.txt"
cd ..\..
```
**Linux/Mac:**
```bash
cd edocr2-main
mkdir -p edocr2/models
cd edocr2/models
wget https://github.com/javvi51/edocr2/releases/download/v1.0.0/recognizer_gdts.keras
wget https://github.com/javvi51/edocr2/releases/download/v1.0.0/recognizer_gdts.txt
wget https://github.com/javvi51/edocr2/releases/download/v1.0.0/recognizer_dimensions_2.keras
wget https://github.com/javvi51/edocr2/releases/download/v1.0.0/recognizer_dimensions_2.txt
cd ../..
```
### 2. Test Locally (Optional but Recommended)
**Windows:**
```bash
run_local.bat
```
**Linux/Mac:**
```bash
chmod +x run_local.sh
./run_local.sh
```
Open: http://localhost:7860
### 3. Create Hugging Face Space
1. Go to https://huggingface.co/spaces
2. Click "Create new Space"
3. Settings:
- Name: `edocr2` (or your choice)
- License: MIT
- SDK: Gradio
- Hardware: CPU Basic (free)
### 4. Clone Space Repository
```bash
git clone https://huggingface.co/spaces/YOUR_USERNAME/edocr2
cd edocr2
```
### 5. Copy Files
**Windows:**
```bash
xcopy /E /I C:\path\to\edocr2-main\* .
```
**Linux/Mac:**
```bash
cp -r /path/to/edocr2-main/* .
```
### 6. Setup Git LFS
```bash
git lfs install
git lfs track "*.keras"
git add .gitattributes
```
### 7. Commit and Push
```bash
git add .
git commit -m "Initial deployment of eDOCr2"
git push origin main
```
**Note:** Upload may take 5-10 minutes for large model files.
### 8. Wait for Build
- Go to your Space URL
- Wait 5-10 minutes for build
- Check "Logs" tab for errors
## β
Verification
Once deployed:
- [ ] Space shows Gradio interface
- [ ] Models load successfully (check logs)
- [ ] Can upload images
- [ ] Processing works
- [ ] Results display correctly
- [ ] Download ZIP works
## π― Your Space URL
After deployment, your Space will be at:
```
https://huggingface.co/spaces/YOUR_USERNAME/edocr2
```
## π Expected Performance
### CPU Basic (Free)
- Processing time: 20-30 seconds per image
- Memory: 2 GB RAM
- Cost: FREE
### T4 GPU (Paid)
- Processing time: 5-10 seconds per image
- Memory: 16 GB RAM
- Cost: $0.60/hour
## π Common Issues
### "Models not found"
- Ensure models are in `edocr2/models/`
- Check Git LFS tracked the files
- Verify file names are correct
### "Out of memory"
- Upgrade to GPU hardware
- Or reduce `max_img_size` in app.py
### "Build failed"
- Check logs for specific error
- Verify all dependencies in requirements.txt
- Ensure packages.txt has system deps
## π Resources
- **Deployment Guide**: See `DEPLOYMENT.md`
- **Hugging Face Docs**: https://huggingface.co/docs/hub/spaces
- **Gradio Docs**: https://gradio.app/docs
- **Original Repo**: https://github.com/javvi51/edocr2
## π Success!
Once deployed, share your Space:
```
π https://huggingface.co/spaces/YOUR_USERNAME/edocr2
```
---
**Questions?** Check `DEPLOYMENT.md` for detailed troubleshooting.
|