| # π¬ Docling API Deployment Guide |
|
|
| ## π¦ **Files in This Folder** |
|
|
| - `app.py` - FastAPI application for document conversion |
| - `requirements.txt` - Python dependencies |
| - `Dockerfile` - Container configuration |
|
|
| ## π **Deploy to Hugging Face** |
|
|
| ### **Method 1: Via Web UI (Easiest)** |
|
|
| 1. Go to **https://huggingface.co/spaces** |
| 2. Click **Create new Space** |
| 3. **Name**: `docling-api` |
| 4. **SDK**: `Docker** |
| 5. **Visibility**: `Public` (free) or `Private` (needs token) |
| 6. Click **Create Space** |
| 7. Upload `app.py` and `requirements.txt` |
| 8. Wait 3-5 minutes for deployment |
|
|
| ### **Method 2: Via Git** |
|
|
| ```bash |
| git clone https://huggingface.co/spaces/YOUR_USERNAME/docling-api |
| cd docling-api |
| cp app.py requirements.txt Dockerfile . |
| git add . |
| git commit -m "Deploy Docling API" |
| git push |
| ``` |
|
|
| ## π§ͺ **Test Your Deployment** |
|
|
| ```bash |
| cd test-scripts |
| python test_docling.py https://YOUR_USERNAME-docling-api.hf.space |
| ``` |
|
|
| ## π‘ **API Documentation** |
|
|
| Once deployed, visit: `https://YOUR_USERNAME-docling-api.hf.space/docs` |
|
|
| ## π§ **Endpoints** |
|
|
| - `GET /` - Health check |
| - `POST /convert` - Full document conversion |
| - `POST /convert/markdown` - Markdown only |
| - `POST /convert/tables` - Tables only |
|
|
| ## π‘ **Tips** |
|
|
| - Start with **Free CPU tier** for testing |
| - Upgrade to **T4 GPU** for production (faster, handles large PDFs) |
| - Keep PDFs under 10MB for best performance |
|
|