Přeskočit navigaci

Cognitive Services SDK Samples

Poslední aktualizace: 17.09.2018
Upravit na GitHubu

These samples will show you how to get up and running using the SDKs for various Cognitive Services. They'll cover a few rudimentary use cases and hopefully express best practices for interacting with the data from these APIs.

Features

Please note that this samples package references an all-in-one SDK which includes all Bing services. Individual packages exist for each service if you would prefer working with smaller assembly sizes. Both individual service packages as well as the all-in-one will have feature parity for a particular service.

This project framework provides examples for the following services:

Run this sample

  1. If you don't already have it, get node.js. Install a version greater than 8.0.

  2. Clone the repository.

    git clone https://github.com/Azure-Samples/cognitive-services-node-sdk-samples.git
    
  3. Install the dependencies.

    cd cognitive-services-node-sdk-samples
    npm install
    
  4. Get a cognitive services API key with which to authenticate the SDK's calls. Sign up here by navigating to the right service and acquiring an API key. You can get a trial key for free which will expire after 30 days.

  5. Set the following environment variables using the information from the service principle that you created. You only need to set the environment variables for which you want to run the samples.

    export AZURE_ENTITY_SEARCH_KEY={your service key}
    export AZURE_WEB_SEARCH_KEY={your service key}
    export AZURE_VIDEO_SEARCH_KEY={your service key}
    export AZURE_NEWS_SEARCH_KEY={your service key}
    export AZURE_IMAGE_SEARCH_KEY={your service key}
    export AZURE_CUSTOM_SEARCH_KEY={your service key}
    export AZURE_VISUAL_SEARCH_KEY={your service key}
    export AZURE_SPELL_CHECK_KEY={your service key}
    export AZURE_COMPUTER_VISION_KEY={your service key}
    export AZURE_CONTENT_MODERATOR_KEY={your service key}
    export AZURE_TEXT_ANALYTICS_KEY={your service key}
    

    [AZURE.NOTE] On Windows, use set instead of export.

  6. Run the sample.

    node index.js
    
  7. Navigate through the console app to play with the examples. If a sample ends prematurely and does not return results, please make sure the service-key being used is valid for that service.

To see the code of each example, simply look at the examples in the Samples folder. They are written to be isolated in scope so that you can see only what you're interested in.

Další ukázky od: Kirthi Krishnamraju