Closed kaaron1 closed 8 years ago
Do you have the image you are using ?
Here are two images I am using that I snagged from the InterConnect 2016 web page.
Can you also include the code you are using to get the image input stream?
So, the images are uploaded to a cloudant DB. The url comes from there. Here is an example.
String imgURLStr = " https://cd9c9031-ef98-4259-b335-d22cc7298aab-bluemix.cloudant.com/sample_nosql_db/1455046131022/g7236.jpg";
String filename = "g7236.jpg";
URL imgURL = new URL(imgURLStr);
service.classify(filename, new BufferedInputStream(imgURL.openStream()), null);
Looks like this is a problem with the way we send the InputStream
..
I noticed that in com.ibm.watson.developer_cloud.http.InputStreamRequestBody the contentLength() method is overwritten to use inputstream.available(). It is my understanding that inputstream.available() should not be used as the content length. When I changed this code and returned -1, meaning the length is unknown, the errors I have been receiving stopped.
I will look into making these changes in a forked branch and sending for review.
@kaaron1 you are the man!
Please make the Pull request to dev
!
Complete. There is a pull request with the change waiting. Thanks, -Kyle
@kaaron1 you are the man!Please make the Pull request to dev! —Reply to this email directly or view it on GitHub.
It's fixed but not released yet.
release in a few seconds
I am using the Watson sdk VisualRecognition class and receiving this error about 70% of the time...
I could not find a solution on stackoverflow.com or dw. I have an image url, and sending imageUrl.openStream() to the service.classify(fileName, InputStream, VisualClassifier) method. For some reason the bites of the image being streamed are often incorrect.
@germanattanasio: I am posting this here as per your request.