开发者社区> 问答> 正文

麻烦帮忙看下阿里云OpenAPI 客户用我的demo在本地也不能运行,也会报错怎么办?

麻烦帮忙看下阿里云OpenAPI 客户用我的demo在本地也不能运行,也会报错?我看代码好像没啥问题,他本地也能ping通我们的域名代码:# 场景一:文件在本地img = open(r'D:\stos\stos\media\image\20240506151034.jpg', 'rb')# 场景二:使用任意可访问的url# url = DOMAIN+'/media/image/'+str(file_name)# img = io.BytesIO(urlopen(url).read())segment_head_request = SegmentHeadAdvanceRequest()segment_head_request.image_urlobject = imgruntime = RuntimeOptions()try:# 初始化Clientclient = Client(config)response = client.segment_head_advance(segment_head_request, runtime)# 获取整体结果# print(response.body)response = requests.get(response.body.data.elements[0].image_url,verify=False)if response.status_code == 200:with open(url_name, 'wb') as file:file.write(response.content)file.close()statement = Trueelse:statement = Falseexcept Exception as error:# 获取整体报错信息print(error)statement = False
dfd75f67bceb3d291cb509a0ab5e7a2e.png
1108fdf38a28f175afbe1d93a917cef4.png
6e800153ce03ad5dcceca4a5cbb6eb34.png
头像分割:https://help.aliyun.com/zh/viapi/use-cases/image-segmentation-1?spm=a2c4g.11186623.0.i60

展开
收起
夹心789 2024-05-29 08:39:15 22 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
AutoTalk第七期:自动化工具-OpenAPI在线调试 立即下载
最大化阿里云OpenAPI能力的方法和实践 立即下载
低代码开发师(初级)实战教程 立即下载