Skip to content
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

表格文字识别、条形码/二维码识别、身份证混贴识别、手写文字识别支持function call 简化OCR识别内容 #172

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions appbuilder/core/components/handwrite_ocr/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,7 @@ def tool_eval(self, name: str, streaming: bool, **kwargs):
req.detect_direction = "true"
req.detect_alteration = "true"
response = self._recognize(req)
out = HandwriteOCROutMsg()
out.direction = response.direction
[out.contents.append(
Content(text=w.words))
for w in response.words_result]
result[file_name] = out.dict()
result[file_name] = [w.words for w in response.words_result]

if streaming:
yield json.dumps(result, ensure_ascii=False)
Expand Down
2 changes: 1 addition & 1 deletion appbuilder/core/components/qrcode_ocr/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def tool_eval(self, name: str, streaming: bool, **kwargs):
raise InvalidRequestArgumentError("location must be a string with value 'true' or 'false'")
req.location = location
resp = self._recognize(req)
result[file_name] = proto.Message.to_dict(resp)["codes_result"]
result[file_name] = [item["text"] for item in proto.Message.to_dict(resp).get("codes_result", [])]
if streaming:
yield json.dumps(result, ensure_ascii=False)
else:
Expand Down
Loading