Puru Rastogi
Puru Rastogi

Reputation: 13

ClarifAI Python API : Passing image captured from Webcam, to API, without saving on hard drive

I am using ClarifAI python API to classify objects capture from my Raspberry PI camera. (the whole program runs on python on raspberry PI).

Now, the two ways in which this [Python API] could be used is:

1> passing the path of the image in hard drive as argument while calling API.
2> passing the URL of the image as argument while calling API.

Now, I want to directly pass the image captured by my Pi Camera, using picamera library to this API, and get the tags, without saving it on the hard drive. How can I do it?
What kind variable I should be using to store the image data and for passing it on ?

Upvotes: 1

Views: 579

Answers (1)

Cassidy
Cassidy

Reputation: 3426

It looks like there's a few ways to go about it.

1) Use the capture function in picamera to save the file, push the file to Clarifai's function tag_images, then delete the file from the drive

2) Post the captured image's bytes to the Imgur (or similar) API and push the resulting URL to Clarifai's tag_image_urls function

3) Use REST instead of the Clarifai Python library and push the image bytes to the /tag endpoint

Upvotes: 1

Related Questions