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

Conversation

sucuicong
Copy link
Contributor

No description provided.

@@ -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)["codes_result"]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

建议此处修改为 proto.Message.to_dict(resp).get("codes_result", $default_value)的形式,避免dict无该成员时抛出异常

@MrChengmo
Copy link
Collaborator

LGTM

@MrChengmo MrChengmo merged commit 6b61b5d into baidubce:master Mar 8, 2024
1 check failed
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.

2 participants