It seems to be no more possible to associate public IMages of IBM Cloud Object Storage with Watson visual recognition. something has been changed in the type of calls between the 2 services. My code below use to work but know it says there is no "images founds" .
import json
from os.path import join, dirname
from os import environ
import sys
import os
import boto3
import pprint
from boto3 import client
from botocore.utils import fix_s3_host
from watson_developer_cloud import VisualRecognitionV3
param_1= "MY S3 KEY"
param_2= "MY S3 SECRET KEY "
param_3= "https://s3-api.us-geo.objectstorage.softlayer.net"
param_4= "MY BUCKET "
param_5= "MY WATSON API KEY "
#The Name of my image I want to analyse that is currently in my bucket and is made public
objectNMAE='THIEF.jpg'
s3ressource = client(
service_name='s3',
endpoint_url= param_3,
aws_access_key_id= param_1,
aws_secret_access_key=param_2,
use_ssl=True,
)
visual_recognition = VisualRecognitionV3('2016-05-20', api_key=param_5)
#The URL of my image I made public with Public ACL
urltobeanalysed="%s/%s/%s" % (param_3,param_4,objectNMAE)
#For Debug, I use an image that can be viewed in a web-browser
URL2="https://fr.wikipedia.org/wiki/Barack_Obama#/media/File:President_Barack_Obama.jpg"
print(json.dumps(visual_recognition.classify(images_url=urltobeanalysed), indent=2))
What is more, the image that is made public used to be displayed in my browser, now when I enter the URL, it is downloading instead.. Any Clues ?
After some research in SO, it seems that IBM COS is aligned with AWS S3 behavior, they changed some thing in object header behavior. I had to specify the content type to be image/jpeg: 'contentType' => 'image/jpeg'
otherwhise nothing was displayed. No it works.