GithubHelp home page GithubHelp logo

cgcel / paddleocrfastapi Goto Github PK

View Code? Open in Web Editor NEW
50.0 50.0 20.0 96 KB

A simple way to deploy PaddleOCR based on FastAPI. (PaddleOCR 的 FastAPI 快速部署方案)

License: MIT License

Dockerfile 14.23% Python 85.77%
docker docker-compose dockerfile fastapi ocr paddleocr

paddleocrfastapi's Introduction

PaddleOCRFastAPI

GitHub

中文

A simple way to deploy PaddleOCR based on FastAPI.

Support Version

PaddleOCR Branch
v2.5 paddleocr-v2.5
v2.7 paddleocr-v2.7

Features

  • Local path image recognition
  • Base64 data recognition
  • Upload file recognition

Deployment Methods

Deploy Directly

  1. 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.

  2. (Optional) Create new virtual environment to avoid dependency conflicts

  3. Install required dependencies

    pip3 install -r requirements.txt
  4. Run FastAPI

    uvicorn main:app --host 0.0.0.0

Docker Deployment

Test completed in Centos 7, Ubuntu 20.04, Ubuntu 22.04, Windows 10, Windows 11, requires Docker to be installed.

  1. 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.

  2. Building a Docker Image

    docker build -t paddleocrfastapi:latest .
  3. Edit docker-compose.yml

    version: "3"
    
    services:
    
      paddleocrfastapi:
        container_name: paddleocrfastapi # Custom Container Name
        image: paddleocrfastapi:lastest # Customized Image Name & Label in Step 2
        environment:
          - TZ=Asia/Hong_Kong
          - OCR_LANGUAGE=ch # support 80 languages. refer to https://github.com/Mushroomcat9998/PaddleOCR/blob/main/doc/doc_en/multi_languages_en.md#language_abbreviations
        ports:
         - 8000:8000 # Customize the service exposure port, 8000 is the default FastAPI port, do not modify
        restart: unless-stopped
  4. Create the Docker container and run

    docker compose up -d
  5. Swagger Page at localhost:<port>/docs

Change language

  1. Clone this repo to localhost.

  2. Edit routers/ocr.py, modify the parameter "lang":

    ocr = PaddleOCR(use_angle_cls=True, lang="ch")

    Before modify, read the supported language list.

  3. Rebuild the docker image, or run the main.py directly.

Screenshots

API Docs: /docs

Swagger

Todo

  • support ppocr v4
  • GPU mode
  • Image url recognition

License

PaddleOCRFastAPI is licensed under the MIT license. Refer to LICENSE for more information.

paddleocrfastapi's People

Contributors

cgcel avatar dimitreeis avatar neozhu avatar terland0berver avatar zmh-program avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

paddleocrfastapi's Issues

性能报告

感谢分享,请问有测试过性能吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.