A simple way to deploy PaddleOCR
based on FastAPI
.
PaddleOCR | Branch |
---|---|
v2.5 | paddleocr-v2.5 |
v2.7 | paddleocr-v2.7 |
- Local path image recognition
- Base64 data recognition
- Upload file recognition
-
Copy the project to the deployment path
git clone https://github.com/cgcel/PaddleOCRFastAPI.git
The master branch is the most recent version of PaddleOCR supported by the project. To install a specific version, clone the branch with the corresponding version number.
-
(Optional) Create new virtual environment to avoid dependency conflicts
-
Install required dependencies
pip3 install -r requirements.txt
-
Run FastAPI
uvicorn main:app --host 0.0.0.0
Test completed in Centos 7
, Ubuntu 20.04
, Ubuntu 22.04
, Windows 10
, Windows 11
, requires Docker
to be installed.
-
Copy the project to the deployment path
git clone https://github.com/cgcel/PaddleOCRFastAPI.git
The master branch is the most recent version of PaddleOCR supported by the project. To install a specific version, clone the branch with the corresponding version number.
-
Building a Docker Image
docker build -t paddleocrfastapi:<your_tag> .
-
Edit
docker-compose.yml
version: "3" services: paddleocrfastapi: container_name: paddleocrfastapi # Custom Container Name image: paddleocrfastapi:<your_tag> # Customized Image Name & Label in Step 2 environment: - TZ=Asia/Hong_Kong ports: - 8000:8000 # Customize the service exposure port, 8000 is the default FastAPI port, do not modify restart: unless-stopped
-
Create the Docker container and run
docker compose up -d
-
Swagger Page at
localhost:<port>/docs
- support ppocr v4
- GPU mode
- Image url recognition
PaddleOCRFastAPI is licensed under the MIT license. Refer to LICENSE for more information.