Google Vision Api



I recently went on an interview for a company that was interested in using the Google Vision API in a variety of ways. So, I thought that it might be a good idea to check out what Google's Vision API is all about.

First off, Google has a ton of API's to work with and they make it easy to try it out in the browser with a built in console.



Here's the link to check it out for yourself: Google Vision API



One of the first things I did was create an api key so that I could validate it with Postman. 

That turned out to be relatively easy. All I had to do was copy the sample code from google, specifying what I wanted to search by, and add the key into the url. 

Then I decided to use JavaScript's Fetch API to make the call to the google API. Here is what it looks like 



So, the fetch request returns the response as an argument of the moodStatus(data) function.

Here's what the response looks like: 



The moodStatus(data) takes the data, and determines which  value to return to state. 

Here is what the react app looks like: 





Want to take a peek at the code? check it out on github: https://github.com/jmb521/mood_tester

I have to say this project was a lot of fun and I've already thought of some other ways I can use it.

Comments

Popular Posts