Getting error in cognitive actions

Hi all,
i am trying to execute IBM’s visual recognition ClassifyImageFromFile but continuosly i m getting same error even after changing some formats like date fromat. can u help me with this.
code:
Cognitive.IBM.VisualRecognition.ClassifyImageFromFile APIKey:’{API KEY}’ VersionDate:“3/20/2020” ImageFile:‘C:\Users\Desktop\oneo.jpg’ Owners:’’ ClassifierIds:’’ Threshold:’’ Language:’’ Timeout:30 Response=> JSONResponse StatusCode=> StatusCode

Error that i get:Unexpected character encountered while parsing value: <. Path ‘’, line 0, position 0.

1 Like

Hello, @hemant.mishra, welcome to the forum.

Might I ask if you have tried to classify the image, not using Robin, as shown in the IBM Watson Visual Recognition tutorial?

A tool you may have on your computer to help with that is Git Bash. I have just tried the tutorial example using the command

curl -u "apikey:{apikey}" "{url}/v3/classify?url=https://ibm.biz/BdzLPG&version=2018-03-19"

and the output is as shown on the tutorial page.

If you are successful with that, it might be easier to determine what is going wrong here. I do notice, however, that the Robin documentation for this function is missing at the moment, perhaps due to the March 10, 2020 upgrade to version 0.93.

Best regards,
burque505

Hello ,@burque505

I have tried in curl and its working properly there and when i run the program in robin i get this error.
error:{ ‘error’: { ‘code’: 400, ‘description’: Please supply a date version parameter, like ‘&version=2016-05-17’., ‘error_id’: parameter_error }, ‘images_processed’: 0 }
400

can u help me with this?

Regards,
Hemant.Mishra

Hello ,
my Robin code is this
code:
Cognitive.IBM.VisualRecognition.ClassifyImageFromUrl APIKey:"{APIKEY}" VersionDate:2016-05-17 ImageUrl:“https://watson-developer-cloud.github.io/doc-tutorial-downloads/visual-recognition/fruitbowl.jpg” Owners:’’ ClassifierIds:’’ Threshold:’’ Language:’’ Timeout:30 Response=> JSONResponse StatusCode=> StatusCode
Console.Write Message: JSONResponse
Console.Write Message: StatusCode

Best Regards,
Hemant.Mishra

1 Like

Hello @hemant.mishra

You need to put quotes on the Version Date as well.

Cognitive.IBM.VisualRecognition.ClassifyImageFromUrl \
    APIKey: '{API Key}' \
    VersionDate:'2016-05-17' \
    ImageUrl:'https://watson-developer-cloud.github.io/doc-tutorial-downloads/visual-recognition/fruitbowl.jpg' \
    Owners:'' \
    ClassifierIds:'' \
    Threshold:'' \
    Language:'' \
    Timeout:30 \
    Response=> JSONResponse StatusCode=> StatusCode
Console.Write Message: JSONResponse
1 Like

@jokoum, thank you, that works perfectly.
I’m still having trouble with images on the local system, which seems to be related to the path.
If I refer to an image as
cli.png

and run a script I get

L4:0 Failed to invoke cognitive action: Could not find file 'C:\Windows\TEMP\97a5a265cd164e948073c482af9f2be0\cli.png'.

If I pass in the actual path, which is

'C:\cli.png'

I get

L4:0 Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

just as @hemant.mishra did above. So it seems all I need to process a file on the local system will be a format for the path that forces Robin to NOT look in the C:\Windows\temp directory. I have tried forward slashes, file URLs, many other schemes, no luck so far.

//Users/burque505/cli.png

yields

L4:0 Failed to invoke cognitive action: Could not find file ‘C:\Users\burque505\cli.png’.

but only if the image is not there. If I put the image in that directory, I get this:

L4:0 Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

This makes me think the path error is being thrown by the image file, not by the path itself.

Curious.

Regards,
burque505

1 Like

Thank you it is working perfectly.

2 Likes

@burque505 I also reproduce that on my end, perhaps @jpap could investigate it further.

1 Like

Thanks, @jokoum, for confirming that!
Regards,
burque505