Skip to content

scottcate/vision_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitter Vision Bot: @vision_api

I wanted to experiment with Azure Cognitive Services, Vision API. SO I thought it would be fun to make a social account that could talk to anyone interested. So @Vision_API on Twitter was born. If tagged on a tweet (or reply) with a photo, the service will reply with a description of the photo.

Getting Started: Consumer

Simply use Twitter and tag the account @vision_api. ( #vision_api hashtag also works). Wait 30 seconds, and the bot should have replied to you with a description of the photo. If Media (a photo) isn't found on the actual tweet tagged, then the service will look up the thread (all the replies of the replies) and will return a description of the first photo found. This is fun to then reply to any photo on Twitter to see the machines description.

The rest of this README addresses developers interested in also playing with the Azure Cog Services.

Getting Started: Developer

If you would like to experiment with the Azure Vision API, you'll need a few items to get started, all of which can be attained for the low cost of $0.00

Prerequisites

Installing

Once the code is cloned, you'll find a local.settings.json file in the root. This file has all the variables you'll need to populate to get started. You probably won't need to post results back to Twitter, if you're just trying to use the Vision API. So the three keys you'll want to complete are ...

  • AzureWebJobsStorage
  • AzureVisionApiSubscriptionKey
  • AzureVisionUriBase

These values will be retrieved in your code with the static method

GetEnvironmentVariable("<< key name >>")

Analyzing a photo

This example is posting a photo that is already uploaded from Twitter. So the method isn't uploading a byte[] (that overload is available, just not used in this demo). Post that to the helper method FetchVisionDescriptionAsync and you'll get back a VisionDescription.

FetchVisionDescriptionAsync(TwitterStatus tweet, TwitterMedia media)

The method posts a small JSON body of the url of the photo.

{"url":"<< fully qualified url here >>"}

To the

Built With

Authors

See also the list of contributors who have (maybe someday) participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgements

  • Special thanks to the contributors of Tweet Moa Sharp - this would have been much harder without their work
  • Twitter friends who endured my countless #vision_api test tweets :)
  • You (for trying this and submitting feedback) :)

Enjoy!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages