https://github.com/aidotse/docling-inference
API service for docling document conversion
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.0%) to scientific vocabulary
Repository
API service for docling document conversion
Basic Info
- Host: GitHub
- Owner: aidotse
- Language: Python
- Default Branch: main
- Size: 318 KB
Statistics
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
Docling inference server
This project provides a FastAPI wrapper around the docling document parser to make it easier to use in distributed production environments.
Running
The easiest way to run this project is using docker. There are two image families, one for cuda machines and one for cpu:
- Cuda: ghcr.io/aidotse/docling-inference:rev
- CPU: ghcr.io/aidotse/docling-inference:cpu-rev
```bash
Create volumes to not have to download models every time
docker volume create hfcache docker volume create ocrcache
Run the container
docker run -d \ --gpus all \ -p 8080:8080 \ -e NUMWORKERS=8 \ -v hfcache:/root/.cache/huggingface \ -v ocr_cache:/root/.EasyOCR \ ghcr.io/aidotse/docling-inference:latest ```
Docker compose
```yaml services: docling-inference: image: ghcr.io/aidotse/docling-inference:latest ports: - 8080:8080 environment: - NUMWORKERS=8 volumes: - hfcache:/root/.cache/huggingface - ocr_cache:/root/.EasyOCR restart: always deploy: resources: reservations: devices: - driver: nvidia count: all capabilities: [gpu]
volumes: hfcache: ocrcache: ```
Local python
Dependencies are handled with uv in this project. Follow their installation instructions if you do not have it.
```bash
Create a virtual environment
uv venv
Install the dependencies
uv sync --extra cpu
OR if you have cuda devices
uv sync --extra cu121
Activate the shell
source .venv/bin/activate
Start the server
python src/main.py ```
Using the API
When the server is started you can find the interactive API documentation at the /docs
endpoint. If you're running locally with the example command, this will be
http://localhost:8080/docs.
There are two main methods to parse documents that take the data on two different formats.
You can use the /parse/url to parse a document from a download link. To call it with
curl from the command line:
sh
curl -X 'POST' \
'http://localhost:8080/parse/url' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"include_json": false,
"output_format": "markdown",
"url": "https://arxiv.org/pdf/2408.09869"
}'
You can also parse files directly with the /parse/file endpoint:
sh
curl -X 'POST' \
'http://localhost:8080/parse/file' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@file-path.pdf;type=application/pdf' \
-F 'data={"include_json":false,"output_format":"markdown"}'
Tip: You can use a service like https://curlconverter.com/ to convert curl commands to
your favourite http client, e.g. requests.
For a full list of available options, please refer to the interactive documentation.
Building
Build the project docker image with one of the following commands
- Cuda:
docker build -t ghcr.io/aidotse/docling-inference:dev . - CPU:
docker build -f Dockerfile.cpu -t ghcr.io/aidotse/docling-inference:dev .
Configuration
Configuration is handled through environment variables. Here is a list of the
available configuration variables. They are defined in src/config.py
NUM_WORKERS: The number of processes to run.LOG_LEVEL: The lowest level of logs to display. One of DEBUG, INFO, WARNING, CRITICAL, ERROR.DEV_MODE: Sets automatic reload of the service. Useful during developmentPORT: The port to run the server on.AUTH_TOKEN: Token to use for authentication. Token is expected in theAuthorization: Bearer: <token>format in the request header. The service is unprotected if this option is omitted.OCR_LANGUAGES: List of language codes to use for optical character optimization. Default is"es,en,fr,de,sv". See https://www.jaided.ai/easyocr/ for the list of all available languages.DO_CODE_ENRICHMENT: Use a code enrichment model in the pipeline. Processes images of code to code.DO_FORMULA_ENRICHMENT: Use a formula enrichment model in the pipeline. Converts formulas to LaTeX.DO_PICTURE_CLASSIFICATION: Use a picture classification model in the pipelinese. Classifies the type of image into a category.DO_PICTURE_DESCRIPTION: Use a picture description model in the pipeline. Uses a small multimodal model to describe images.
Owner
- Name: AI Sweden
- Login: aidotse
- Kind: organization
- Email: info@ai.se
- Location: Sweden
- Website: www.ai.se
- Repositories: 14
- Profile: https://github.com/aidotse
AI Sweden is a national center for applied AI research and innovation, with the aim to strengthen the competitiveness of the Swedish industry
GitHub Events
Total
- Create event: 6
- Release event: 2
- Issues event: 4
- Watch event: 31
- Delete event: 2
- Issue comment event: 2
- Member event: 1
- Push event: 13
- Fork event: 7
Last Year
- Create event: 6
- Release event: 2
- Issues event: 4
- Watch event: 31
- Delete event: 2
- Issue comment event: 2
- Member event: 1
- Push event: 13
- Fork event: 7
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 2
- Total pull requests: 0
- Average time to close issues: about 1 month
- Average time to close pull requests: N/A
- Total issue authors: 2
- Total pull request authors: 0
- Average comments per issue: 1.5
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 0
- Average time to close issues: about 1 month
- Average time to close pull requests: N/A
- Issue authors: 2
- Pull request authors: 0
- Average comments per issue: 1.5
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- yi-ge (1)
- etsien (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- python 3.11-slim-bookworm build
- 107 dependencies
- docling ^2.10.0
- fastapi ^0.115.6
- python ^3.11
- python-multipart ^0.0.19
- torch ^2.5.1
- uvicorn ^0.32.1
- actions/checkout v3 composite
- docker/build-push-action v6 composite
- docker/setup-buildx-action v3 composite