Hello I am saving my images to firebase and want to use them with Watson Image Recognition but firebase only gives me a download link and that doesn't seem to work with the Watson Api. Is there a way to get this to work our would there be a better way for me save my images on the web. Thanks for the help
Asked
Active
Viewed 177 times
1 Answers
0
Get the Firebase URL via the yourRef.downloadUrl()
method:
https://firebase.google.com/docs/storage/ios/download-files
Then you can use this URL in the Watson API call using their SDK
import VisualRecognitionV3
let apiKey = "your-apikey-here"
let version = "YYYY-MM-DD" // use today's date for the most recent version
let visualRecognition = VisualRecognition(apiKey: apiKey, version: version)
let url = "your-image-url"
let failure = { (error: Error) in print(error) }
visualRecognition.classify(image: url, failure: failure) { classifiedImages in
print(classifiedImages)
}
Reference: https://github.com/watson-developer-cloud/swift-sdk#visual-recognition
Reference: https://github.com/firebase/firebase-ios-sdk

Mike S.
- 4,806
- 1
- 33
- 35
-
You should include what you tried in your question to allow people to better assist but Watson's SDK for iOS does support URL string. If you need the object, then download it and store as UIImage but you will have to review Watson API to see if other data types to submit for recognition service – Mike S. Jun 05 '17 at 21:15
-
i have the image on saved in memory but the function visualRecognition.classify(image: url)... needs a url to obtain the picture and im confused what url to use. – harry Jun 05 '17 at 21:47
-
even once you fetched the image from firebase how would you send a url for it to Watson that is basically my question. – harry Jun 05 '17 at 21:57
-
Your post is vague and you should include what you attempted and clarify the question. What you are asking is how to get the URL to the file on Firebase to pass it via reference to Watson API. You can use the `downloadUrl` method on your object reference to get a URL string, then pass that to Watson. I edited my answer above accordingly. – Mike S. Jun 06 '17 at 14:51