发布

  • Chore: don't pass empty language code to tesseract CLI (#1996)

    frostbyte_neo 发布于 2023-11-07 01:30:12 +00:00

    Summary:

    Close: https://github.com/Unstructured-IO/unstructured/issues/1920

    • stop passing in empty string from languages to tesseract, which will
      result in passing empty string to language config -l for the tesseract
      CLI
    • also stop passing in duplicate language code from languages to
      tesseract OCR
    • if we failed to convert any iso languages from the languages
      parameter, proceed OCR with eng as default

    Test

    • First confirm the tesseract error Estimating resolution as X before
      this:
    • on the unstructured-api repo with main branch, run make run-web-app
    • curl to test error from empty string, or just any wrong input like -F 'languages="eng,de"':
    curl -X 'POST'  'http://0.0.0.0:8000/general/v0/general' \
     -H 'accept: application/json'   \
    -H 'Content-Type: multipart/form-data' \
    -F 'files=@sample-docs/layout-parser-paper-with-table.jpg' \
    -F 'languages=""'  \
    -F 'strategy=hi_res'  \
    -F 'pdf_infer_table_structure=True' \
    | jq -C . | less -R
    
    • after this change:
      • in your unstructured API env, cd to unstructured repo and install it locally with pip install -e .
      • check out to this branch
      • run make run-web-app again in api repo
      • the curl command return output and see warning in log

    Co-authored-by: qued 64741807+qued@users.noreply.github.com

    下载附件