Bing Image Search API-Cognitive part2

In this tutorial we will learn how to use Bing Image Search API , Remember in our First Example of cognitive services we had created a demo Bing Speech API , In this tutorial we will extend the same demo to search image i.e. we will pass the text result of Bing Speech API to Bing Image Search API, yes and we will call the cognitive service using https REST like we are calling normal https web  services , In our first example of Bing Speech API we had used .net Client Library to make REST call of API for the ease in .net. As all the cognitive services are https REST API that can be called using any language which makes an https call. If you had missed part1 of this series you can find it here.

To register for Bing Image Search API follow the steps.

  1. Navigate to https://azure.microsoft.com/en-us/try/cognitive-services/
  2. Navigate to Search tab and select Bing Search API and press get api key.search.png
  3. Select I agree and Your region as shown in imageregion
  4. Login with your account to get keysign_in
  5. Save your keykey.png

 

Now It’s time to recall the part-1, In which we had covered Speech to Text (STT) using Bing Speech API, We will simply use It’s result as input for Bing Image Search API.

Here onResponseReceived method we will get text of what we had speak, now will use that text as input for Bing Image Search API, As show in below method,

In Above method will simply making https REST request to API (that means it is not necessary that one can use cognitive services only in WPF application or using C# language, one can use it with any other language) and it will result json response.

Now let’s perform following steps to implement Bing Image Search API. first download part1 from here.

  • First add Image tag in MainWindow.xaml or simply change the code between <Grid></Grid> with given code below.
  • Then  inside Solution explorer, right click your project and click manage nuget packages,Screenshot (30)
  • Inside NuGet Package manger window navigate to browse tab and search for Newtonsoft.Jsonjson.png
  • Also right click on reference and reference of System.WebSystem_web.png
  • Create a class or data structure to store the json Result as per your need (optional)
  • Finally Add Search Image Method and it’s call to MainWindow.xaml.cs

 

Source Code

Output:

Output.png

Advertisements

1 thought on “Bing Image Search API-Cognitive part2”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s