Skip to content

feat: adapt rapidocr v2 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2025
Merged

feat: adapt rapidocr v2 #1

merged 3 commits into from
May 22, 2025

Conversation

SWHL
Copy link
Member

@SWHL SWHL commented May 22, 2025

No description provided.

@SWHL SWHL requested a review from Copilot May 22, 2025 00:21
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adapts rapidocr to v2 by unifying backend selection and updating example usage.

  • Removed the extras_require block in setup.py that previously provided optional dependencies for different backends.
  • Replaced the conditional backend imports in rapidocr_api/main.py with a unified import from rapidocr and updated OCR result processing.
  • Updated demo.py to use perf_counter for more precise time measurement and increased HTTP request timeouts.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
setup.py Removed the extras_require block to streamline dependency management.
rapidocr_api/main.py Simplified backend import and altered OCR result processing via zip over result lists.
demo.py Updated timing functions and extended timeout values for HTTP requests.
Comments suppressed due to low confidence (3)

setup.py:78

  • Removal of the extras_require block eliminates optional dependencies for onnx, paddle, and openvino backends. Ensure that this change is intentional and that relevant documentation reflects this update.
extras_require={

rapidocr_api/main.py:50

  • [nitpick] Using zip to iterate over ocr_res.boxes, ocr_res.txts, and ocr_res.scores assumes these lists are of equal length. Consider handling potential mismatches if the lengths of these lists differ.
for i, (boxes, txt, score) in enumerate(zip(ocr_res.boxes, ocr_res.txts, ocr_res.scores)):

rapidocr_api/main.py:16

  • The conditional backend imports have been replaced with a unified import. Confirm that the unified RapidOCR API reliably supports all backend functionalities previously handled by the conditional logic.
from rapidocr import RapidOCR

@SWHL SWHL merged commit 2d81290 into main May 22, 2025
@SWHL SWHL deleted the develop branch May 22, 2025 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant