Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker compose file and add docker to the readme.md #467

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN python3 -m venv /opt/mineru_venv
# Activate the virtual environment and install necessary Python packages
RUN /bin/bash -c "source /opt/mineru_venv/bin/activate && \
pip install --upgrade pip && \
pip install magic-pdf[full-cpu] detectron2 --extra-index-url https://myhloli.github.io/wheels/"
pip install magic-pdf[full]==0.7.0b1 detectron2 --extra-index-url https://myhloli.github.io/wheels/"

# Copy the configuration file template and set up the model directory
COPY magic-pdf.template.json /root/magic-pdf.json
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,27 @@ In non-mainline environments, due to the diversity of hardware and software conf

[Click here for the online demo](https://opendatalab.com/OpenSourceTools/Extractor/PDF)

### Docker demo
#### Install docker and docker compose
[https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)

#### 2. Download model weight files

Refer to [How to Download Model Files](docs/how_to_download_models_en.md) for detailed instructions.
> ❗️After downloading the models, please make sure to verify the completeness of the model files.
>
> Check if the model file sizes match the description on the webpage. If possible, use sha256 to verify the integrity of the files.

#### Edit docker-compose.yaml
In the docker compose you need to change a few thing:
Under the volumes you can set the input and output folder
And the path where the dowloaded models are stored

### Run the docker-compose file
Make sure you have a pdf file in the input folder
Then in the same folder as the docker-compose.yaml run:
``docker compose up``

### Quick CPU Demo

#### 1. Install magic-pdf
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
mineru:
build: .
container_name: mineru
volumes:
# Replace first path with the path on the local file system where the models are stored
- ./models:/opt/models
# Replace first path with the path where to get the input pdf's from
- ./input:/input
# Replace the first path with the path where the output is saved to on the local file path
- ./output:/output
command: magic-pdf -p /input -o /output -m auto
Loading