Sign inSign up

erikvullings/mineru-api

By erikvullings

•Updated over 1 year ago

OpenAPI service for [MinerU](https://mineru.net/), a tool to convert PDF into markdown.

Image
Machine learning & AI
Data science
0

2.0K

erikvullings/mineru-api repository overview

⁠MinerU API on GPU

MinerU⁠ is a tool that converts PDFs into machine-readable formats (e.g., markdown, JSON), allowing for easy extraction into any format. MinerU was born during the pre-training process of InternLM. We focus on solving symbol conversion issues in scientific literature and hope to contribute to technological development in the era of large models. Compared to well-known commercial products, MinerU is still young. If you encounter any issues or if the results are not as expected, please submit an issue on issue and attach the relevant PDF.

This repo⁠ presents an alternative API for MinerU, one where you can upload a PDF and process all pages to Markdown. Note that this image has been compiled to use NVIDIA GPU CUDA⁠ v12.3.2 and cuDNN9⁠.

⁠Run the image

docker run --rm --gpus all -p 8000:8000 erikvullings/mineru-api:gpu

Access the OpenAPI at http://localhost:8000/docs⁠, assuming you use port 8000.

⁠Build Docker image

Installation instructions for PaddlePaddle v3.0b1⁠

docker build -t mineru-api .
docker run --rm --gpus all -p 8000:8000 mineru-api

To publish it (optionally, log in first to the registry):

docker image tag mineru-api:latest erikvullings/mineru-api:gpu
docker image push erikvullings/mineru-api:gpu

⁠Test the API

You can use the OpenAPI service⁠, assuming you are using port 8000, which offers two services:

  • /convert/zip: which converts a PDF document and returns a ZIP file containing markdown and images.
  • /convert/markdown: which converts a PDF document and returns the markdown, optionally including images using base64 encoding.

Or you can use curl, e.g. replace document.pdf with your PDF file and enter:

curl -X POST "http://localhost:8000/convert/zip" \
  -H "Content-Type: multipart/form-data" \
  -F "[email protected]" \
  -F "start=1" \
  -F "end=5" \
  --output result.zip

Tag summary

Content type

Image

Digest

sha256:6715c706e…

Size

12.1 GB

Last updated

over 1 year ago

docker pull erikvullings/mineru-api:gpu