2
votes

I want to use the visual Recognition from IBM (Classify an image) by using python 3.7 but it gives this error :

main:3: DeprecationWarning: VisualRecognitionV3 is a deprecated function. watson-developer-cloud moved to ibm-watson

Whatever I try to do it gives the same error :

import json
from watson_developer_cloud import VisualRecognitionV3
visual_recognition = VisualRecognitionV3(
     '2018-03-19',
     iam_apikey='API_KEY')
2
@skagreen123, I added the deprecation as just as a warning. You should be able to invoke the method without any error. - Erika Dsouza

2 Answers

2
votes

Check the installation guide at for the project. The package has moved to ibm-watson, so you should install that package and import from it

0
votes
from ibm_watson import VisualRecognitionV3
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

authenticator = IAMAuthenticator(api_key)
visual_rec = VisualRecognitionV3('2020-07-14',authenticator = authenticator)

import json
class_ = visual_rec.classify(url=image_url , threshold=0.5 , classifier_ids=None).get_result()
print(json.dumps(class_ , indent=2))