Watson Studio

 View Only

Getting Predictions from Natural Language Classifier in Python Flask Application

  • 1.  Getting Predictions from Natural Language Classifier in Python Flask Application

    Posted Mon June 07, 2021 12:34 PM
    I have a model train in the Natural Language Classifier service. I am using the code in implementation section to get a prediction in a python application. This is the code that i used:


    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

    # In the constructor, letting the SDK manage the token
    authenticator = IAMAuthenticator(apikey, url=url)
    natural_language_classifier = NaturalLanguageClassifierV1(authenticator)
    natural_language_classifier.classify(classifier_id, 'How hot will it be today?')

    but i am getting this error: 
    ApiException: Error: Unauthorized, Code: 401 , X-global-transaction-id: ca4cdc72-2b96-492e-853c-22ec09f052f0
    


    ------------------------------
    JOSHVA SILVASSTAR
    ------------------------------