Spaces:
Sleeping
Sleeping
FROM ubuntu:22.04 | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update && \ | |
apt-get install -y software-properties-common && \ | |
add-apt-repository ppa:deadsnakes/ppa && \ | |
apt-get update && \ | |
apt-get install -y \ | |
python3.10 \ | |
python3.10-venv \ | |
python3.10-distutils \ | |
python3-pip \ | |
wget \ | |
git \ | |
libgl1 \ | |
libreoffice \ | |
fonts-noto-cjk \ | |
fonts-wqy-zenhei \ | |
fonts-wqy-microhei \ | |
ttf-mscorefonts-installer \ | |
fontconfig \ | |
libglib2.0-0 \ | |
libxrender1 \ | |
libsm6 \ | |
libxext6 \ | |
poppler-utils && \ | |
rm -rf /var/lib/apt/lists/* | |
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 | |
WORKDIR /app | |
COPY requirements.txt . | |
RUN python3 -m venv /opt/mineru_venv && \ | |
. /opt/mineru_venv/bin/activate && \ | |
pip install --upgrade pip && \ | |
pip install -r requirements.txt | |
# Download model + setup config | |
RUN wget https://github.com/opendatalab/MinerU/raw/master/scripts/download_models_hf.py -O download_models.py && \ | |
. /opt/mineru_venv/bin/activate && \ | |
python3 download_models.py && \ | |
wget https://github.com/opendatalab/MinerU/raw/master/magic-pdf.template.json -O /root/magic-pdf.json && \ | |
sed -i 's|"device": "cpu"|"device": "cpu"|g' /root/magic-pdf.json | |
COPY app.py . | |
CMD ["/opt/mineru_venv/bin/uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |