watson-developer-cloud / python-sdk

:snake: Client library to use the IBM Watson services in Python and available in pip as watson-developer-cloud
https://pypi.org/project/ibm-watson/
Apache License 2.0
1.46k stars 828 forks source link

503 Internal Server Error (Write) from IBM Watson Visual Recognition Service with Python SDK #762

Closed jerod-estapa closed 3 years ago

jerod-estapa commented 3 years ago

I am trying to create a visual recognition classifier for the Watson Visual Recognition service:

from ibm_watson import VisualRecognitionV3, ApiException
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

visual_recognition = VisualRecognitionV3(
    version='2018-03-19',
)

try:
    with open('./img/burgers.zip', 'rb') as food, open(
                    './img/hot_dogs.zip', 'rb') as hot_dogs:
        model = visual_recognition.create_classifier(
            'food',
            positive_examples={'burgers': burgers},
            negative_examples=hot_dogs).get_result()
    print(json.dumps(model, indent=2))
except ApiException as ex:
    print(f'Method failed with status code {str(ex.code)}: {ex.message}')

But I keep getting a 503 error back:

<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&#32;&#35;4&#46;377f1cb8&#46;1604430314&#46;136c3668
</BODY></HTML>
Traceback (most recent call last):
  File "/Users/.../lib/python3.8/site-packages/ibm_cloud_sdk_core/base_service.py", line 224, in send
    raise ApiException(
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&#32;&#35;4&#46;377f1cb8&#46;1604430314&#46;136c3668
</BODY></HTML>
, Code: 503
Method failed with status code 503: <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&#32;&#35;4&#46;377f1cb8&#46;1604430314&#46;136c3668
</BODY></HTML>

I can classify an image with the same credentials, so I'm not sure why classifier creation is not working.

Edit: I have tried with curl as well, and it's the same response, so it's probably not the SDK. Any guidance on the 503 would still be greatly appreciated, though, since it's pretty generic.

mamoonraja commented 3 years ago

@jerodestapa Thanks for opening the issue, looks like an intermittent service issue, can you still re-create it?

apaparazzi0329 commented 3 years ago

Issue appears to have been an intermittent service issue. If this issue persists, feel free to create a new issue and it will be addressed. Closing as resolved