基于百度云API和讯飞云API的手写单据识别 demo app,同时使用了 streamlit 构建 UI 界面。
Handwriting OCR using Baidu cloud API and Xfyun API.
Setup poetry (one time setup):
python -m pip install -U pip
python -m pip install poetry
Write your environment files:
# for xfyun, please generate your XF_APP_ID and XF_APP_KEY from https://www.xfyun.cn/doc/platform/quickguide.html
# for baidu, please generate your credentials from https://console.bce.baidu.com/ai/#/ai/ocr/app/list
# and put them here
echo > .env <<EOF
# 如果你用的是讯飞云 API
XF_APP_ID=<app_id>
XF_APP_KEY=<app_key>
# 如果你用的是百度 API,注意区分 APP/API
BAIDU_APP_ID=<app_id>
BAIDU_API_KEY=<app_key>
BAIDU_API_SECRET=<app_secret>
EOF
Running via poetry
:
# install dependencies
poetry install --no-root
# run the app
poetry run streamlit run handwriting_ocr/app.py
Running via docker:
docker build -t handwriting_ocr .
docker run -p 8501:8501 -v $(pwd)/.env:/app/.env handwriting_ocr
If you have updated the dependencies, please run:
poetry lock
poetry run isort . --profile black
poetry run black .