使用 IBM Watson Visual Recognition 创建分类器时出现 503 Internal Server Error
503 Internal Server Error raised when creating classifier using IBM Watson Visual Recognition
我是 Watson Visual Recognition 的初学者,正在尝试创建一个自定义分类器来对狗的图像进行分类。但是,当我尝试创建如下代码片段所示的分类器时,出现错误。
with open ('beagle.zip','rb') as beagles,open ('golden-retriever.zip','rb') as golden_retrievers,open `('husky.zip','rb') as huskies:`
classifier = visrec.create_classifier(name = 'dog_classifier',positive_examples = `{'beagles':beagles,'golden_retrievers':golden_retrievers,'huskies': 'huskies'})`
这里是错误:
classifier = visrec.create_classifier(name = 'dog_classifier',positive_examples = {'beagles':beagles,'golden_retrievers':golden_retrievers,'huskies': 'huskies'})
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ibm_watson/visual_recognition_v3.py", line 282, in create_classifier
response = self.send(request)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ibm_cloud_sdk_core/base_service.py", line 302, in send
raise ApiException(response.status_code, http_response=response)
ibm_cloud_sdk_core.api_exception.ApiException: Error: <HTML><HEAD>
<TITLE>Internal Server Error</TITLE>
</HEAD><BODY>
<H1>Internal Server Error - Write</H1>
The server encountered an internal error or misconfiguration and was unable to
complete your request.<P>
Reference #4.9436d517.1617113574.3744472
</BODY></HTML>
, Code: 503
我该如何解决这个问题?
503
表示服务不可用。如果你试图击中它时可能会下降。
当前状态显示已启动 - https://cloud.ibm.com/status
您是否仍然遇到同样的错误?
API 文档 (https://cloud.ibm.com/apidocs/visual-recognition/visual-recognition-v3?code=python#createclassifier) 中的示例代码是
import json
from ibm_watson import VisualRecognitionV3
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
authenticator = IAMAuthenticator('{apikey}')
visual_recognition = VisualRecognitionV3(
version='2018-03-19',
authenticator=authenticator
)
visual_recognition.set_service_url('{url}')
with open('./beagle.zip', 'rb') as beagle, open(
'./golden-retriever.zip', 'rb') as goldenretriever, open(
'./husky.zip', 'rb') as husky, open(
'./cats.zip', 'rb') as cats:
model = visual_recognition.create_classifier(
'dogs',
positive_examples={'beagle': beagle, 'goldenretriever': goldenretriever, 'husky': husky},
negative_examples=cats).get_result()
print(json.dumps(model, indent=2))
确保您已正确设置服务 url。端点应与您在其中创建视觉识别服务的区域相匹配。您可以验证 url 应该是什么,因为它将在您从中获取 API 密钥的同一位置可用。
在我写上一段时考虑到这一点,我意识到由于您是 Watson Visual Recognition 的新手,您可能尚未创建服务实例或生成 API 密钥。由于该服务已被弃用,您可能无法这样做。如果是这种情况,恐怕您将无法使用该服务。
我是 Watson Visual Recognition 的初学者,正在尝试创建一个自定义分类器来对狗的图像进行分类。但是,当我尝试创建如下代码片段所示的分类器时,出现错误。
with open ('beagle.zip','rb') as beagles,open ('golden-retriever.zip','rb') as golden_retrievers,open `('husky.zip','rb') as huskies:`
classifier = visrec.create_classifier(name = 'dog_classifier',positive_examples = `{'beagles':beagles,'golden_retrievers':golden_retrievers,'huskies': 'huskies'})`
这里是错误:
classifier = visrec.create_classifier(name = 'dog_classifier',positive_examples = {'beagles':beagles,'golden_retrievers':golden_retrievers,'huskies': 'huskies'})
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ibm_watson/visual_recognition_v3.py", line 282, in create_classifier
response = self.send(request)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ibm_cloud_sdk_core/base_service.py", line 302, in send
raise ApiException(response.status_code, http_response=response)
ibm_cloud_sdk_core.api_exception.ApiException: Error: <HTML><HEAD>
<TITLE>Internal Server Error</TITLE>
</HEAD><BODY>
<H1>Internal Server Error - Write</H1>
The server encountered an internal error or misconfiguration and was unable to
complete your request.<P>
Reference #4.9436d517.1617113574.3744472
</BODY></HTML>
, Code: 503
我该如何解决这个问题?
503
表示服务不可用。如果你试图击中它时可能会下降。
当前状态显示已启动 - https://cloud.ibm.com/status
您是否仍然遇到同样的错误?
API 文档 (https://cloud.ibm.com/apidocs/visual-recognition/visual-recognition-v3?code=python#createclassifier) 中的示例代码是
import json
from ibm_watson import VisualRecognitionV3
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
authenticator = IAMAuthenticator('{apikey}')
visual_recognition = VisualRecognitionV3(
version='2018-03-19',
authenticator=authenticator
)
visual_recognition.set_service_url('{url}')
with open('./beagle.zip', 'rb') as beagle, open(
'./golden-retriever.zip', 'rb') as goldenretriever, open(
'./husky.zip', 'rb') as husky, open(
'./cats.zip', 'rb') as cats:
model = visual_recognition.create_classifier(
'dogs',
positive_examples={'beagle': beagle, 'goldenretriever': goldenretriever, 'husky': husky},
negative_examples=cats).get_result()
print(json.dumps(model, indent=2))
确保您已正确设置服务 url。端点应与您在其中创建视觉识别服务的区域相匹配。您可以验证 url 应该是什么,因为它将在您从中获取 API 密钥的同一位置可用。
在我写上一段时考虑到这一点,我意识到由于您是 Watson Visual Recognition 的新手,您可能尚未创建服务实例或生成 API 密钥。由于该服务已被弃用,您可能无法这样做。如果是这种情况,恐怕您将无法使用该服务。