Skip to content

Commit

Permalink
Merge pull request #172 from sucuicong/master
Browse files Browse the repository at this point in the history
表格文字识别、条形码/二维码识别、身份证混贴识别、手写文字识别支持function call 简化OCR识别内容
  • Loading branch information
MrChengmo authored Mar 8, 2024
2 parents 334ec67 + 208266e commit 6b61b5d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
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

0 comments on commit 6b61b5d

Please sign in to comment.