diff --git a/appbuilder/core/components/general_ocr/component.py b/appbuilder/core/components/general_ocr/component.py index 6ba4efbc3..f0b3f5845 100644 --- a/appbuilder/core/components/general_ocr/component.py +++ b/appbuilder/core/components/general_ocr/component.py @@ -169,7 +169,6 @@ def tool_eval(self, name: str, streaming: bool, **kwargs): "识别结果": " \n".join(item["words"] for item in result["words_result"]) } res = json.dumps(results, ensure_ascii=False, indent=4) - print(res) if streaming: yield { "type": "text", diff --git a/appbuilder/tests/test_general_ocr.py b/appbuilder/tests/test_general_ocr.py index 184ec5049..69a2289a6 100644 --- a/appbuilder/tests/test_general_ocr.py +++ b/appbuilder/tests/test_general_ocr.py @@ -29,10 +29,6 @@ def setUp(self): Returns: None. """ - import os - os.environ["GATEWAY_URL"] = "https://apaas-api.test.baidu-int.com" - os.environ["APPBUILDER_TOKEN"] = \ - "Bearer bce-v3/ALTAK-XKQZTTmtiBRWFOXTRNkkW/71d288bbbdd824ab7804d3795a71e2acd5ad1f3b" self.general_ocr = appbuilder.GeneralOCR() def test_run_with_raw_image(self): @@ -46,10 +42,7 @@ def test_run_with_raw_image(self): None """ - image_url = "https://bj.bcebos.com/v1/appbuilder/general_ocr_test.png?" \ - "authorization=bce-auth-v1%2FALTAKGa8m4qCUasgoljdEDAzLm%2F2024-01-" \ - "11T10%3A59%3A17Z%2F-1%2Fhost%2F081bf7bcccbda5207c82a4de074628b04ae" \ - "857a27513734d765495f89ffa5f73" + image_url = "http://gzbh-ns-map-na029.gzbh.baidu.com:8521/img1.png" raw_image = requests.get(image_url).content # Create message with raw_image @@ -138,10 +131,7 @@ def test_run_without_image_and_url(self): def test_tool_eval_valid(self): """测试 tool 方法对有效请求的处理。""" - image_url = "https://bj.bcebos.com/v1/appbuilder/general_ocr_test.png?" \ - "authorization=bce-auth-v1%2FALTAKGa8m4qCUasgoljdEDAzLm%2F2024-01-" \ - "11T10%3A59%3A17Z%2F-1%2Fhost%2F081bf7bcccbda5207c82a4de074628b04ae" \ - "857a27513734d765495f89ffa5f73" + image_url = "http://gzbh-ns-map-na029.gzbh.baidu.com:8521/img1.png" result = self.general_ocr.tool_eval(name="general_ocr", streaming=True, img_url=image_url) res = [item for item in result] self.assertNotEqual(len(res), 0)