MobileAgent icon indicating copy to clipboard operation
MobileAgent copied to clipboard

使用阿里的ocr服务,是否需要在配置里面加入OCR_ACCESS_KEY_ID和OCR_ACCESS_KEY_SECRET

Open sunnyingit opened this issue 8 months ago • 1 comments

执行:python run.py --instruction="Open Chrome and search the PC-Agent paper." --mac 1 报错:缺失了OCR_ACCESS_KEY_ID配置

之后,我在config.json中增加了OCR_ACCESS_KEY_ID, OCR_ACCESS_KEY_SECRET。开通了OCR服务,并通过阿里云平台验证这两个参数可以解析图片。

但运行python run.py --instruction="Open Chrome and search the PC-Agent paper." --mac 1,依然连接不上,是还有什么配置问题吗?

task_1/screenshot_1.png Traceback (most recent call last): File "/Users/lisun/workplace/MobileAgent/PC-Agent/PCAgent/text_localization.py", line 62, in ocr outputs = Sample.main(image) File "/Users/lisun/workplace/MobileAgent/PC-Agent/PCAgent/text_localization.py", line 33, in main output = client.recognize_all_text_with_options(recognize_all_text_request, runtime) File "/Users/lisun/workplace/MobileAgent/PC-Agent/.venv/lib/python3.10/site-packages/alibabacloud_ocr_api20210707/client.py", line 354, in recognize_all_text_with_options self.call_api(params, req, runtime) File "/Users/lisun/workplace/MobileAgent/PC-Agent/.venv/lib/python3.10/site-packages/alibabacloud_tea_openapi/client.py", line 2015, in call_api return self.do_request(params, request, runtime) File "/Users/lisun/workplace/MobileAgent/PC-Agent/.venv/lib/python3.10/site-packages/alibabacloud_tea_openapi/client.py", line 1492, in do_request raise UnretryableException(_last_request, _last_exception) Tea.exceptions.UnretryableException: ('Connection aborted.', TimeoutError('The write operation timed out'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/lisun/workplace/MobileAgent/PC-Agent/run.py", line 647, in perception_infos, width, height = get_perception_infos(screenshot_file, screenshot_som_file, font_path=args.font_path) File "/Users/lisun/workplace/MobileAgent/PC-Agent/run.py", line 335, in get_perception_infos sub_text, sub_coordinates = ocr(img) # for api File "/Users/lisun/workplace/MobileAgent/PC-Agent/PCAgent/text_localization.py", line 64, in ocr raise OCRError(e.message) PCAgent.text_localization.OCRError: RetryError("('Connection aborted.', TimeoutError('The write operation timed out'))")

sunnyingit avatar Mar 05 '26 07:03 sunnyingit

config.json完整配置: { "vl_model_name": "qwen-vl-max", "llm_model_name": "qwen-max", "token": "sk-xxxx", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1", "OCR_ACCESS_KEY_ID": "xxxx", "OCR_ACCESS_KEY_SECRET": "xxxxx" }

sunnyingit avatar Mar 05 '26 07:03 sunnyingit