Skip to content

Commit

Permalink
Download models on build
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkosm committed Dec 27, 2024
1 parent 24703bb commit df63e02
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,21 @@ COPY . ./
COPY magic-pdf.gpu.json /root/magic-pdf.json

RUN python3.10 download_models.py

#serverless
# CMD ["sh", "-c", "ls && python3.10 serverless.py"]

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "3000"]
# Download and set up models
RUN mkdir -p models && \
# Download PP Detect Model
curl -L -o models/det_model.tar paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_det_infer.tar && \
tar -xvf models/det_model.tar -C models/ && \
rm models/det_model.tar && \
\
# Download PP Rec Model
curl -L -o models/rec_model.tar paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_rec_infer.tar && \
tar -xvf models/rec_model.tar -C models/ && \
rm models/rec_model.tar

CMD ["python3.10", "-m", "app.serverless"]

# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "3000"]

0 comments on commit df63e02

Please sign in to comment.