GithubHelp home page GithubHelp logo

azure-samples / cognitive-services-node-sdk-samples Goto Github PK

View Code? Open in Web Editor NEW
40.0 24.0 44.0 6.06 MB

This sample demonstrates how to use the bing search api using the azure-cognitiveservices-search package in node.js.

License: MIT License

JavaScript 100.00%

cognitive-services-node-sdk-samples's Introduction

page_type languages products description urlFragment
sample
javascript
azure
These samples will show you how to get up and running using the SDKs for various Cognitive Services.
cognitive-services-node-sdk-samples

Cognitive Services SDK Samples (Node)

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. Create a new Azure account, and try Cognitive Services for free.

  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_CUSTOM_VISION_TRAINING_KEY={your service key}
    export AZURE_CUSTOM_VISION_PREDICTION_KEY={your service key}
    

    [AZURE.NOTE] On Windows, use set instead of export. [AZURE.NOTE] For Custom Vision Service samples you need to set both keys.

  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.

cognitive-services-node-sdk-samples's People

Contributors

aahill avatar amarzavery avatar areddish avatar dependabot[bot] avatar erhopf avatar jongio avatar josuejoshua avatar kirthik avatar kpajdzik avatar microsoftopensource avatar mikedodaro avatar mohabghanem avatar msftgits avatar shthowse avatar supernova-eng avatar v-hearya avatar v-jaswel avatar wiazur avatar williexu avatar zzhxiaofeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cognitive-services-node-sdk-samples's Issues

Cognitive Service JS SDK sample out of date

The referenced packages are deprecated:

const TrainingApiClient = require("azure-cognitiveservices-customvision-training");
const PredictionApiClient = require("azure-cognitiveservices-customvision-prediction");

Trying to install these packages gives a deprecation warning.

$ npm install azure-cognitiveservices-customvision-training
npm WARN deprecated [email protected]: This package is deprecated in favor of @azure/cognitiveservices-customvision-training which works both on node.js and browsers

The current packages are @azure/cognitiveservices-customvision-training and @azure/cognitiveservices-customvision-prediction.

They may also be other changes needed.

Required minimum Node.js bump for Azure SDK

Minimum Node.js version may be incorrect

This issue was created because the following file has been flagged with an out-of-date version number for Node.js: README.md

Required Fix: The Azure SDK now supports a minimum Node.js version of LTS (long term support).

Please fix this file to indicate LTS support and remove the specific version number it currently references found on line 36. If you find your code sample no longer works when moving up to the LTS version, please log an issue against the specific Azure SDK at https://github.com/azure/azure-sdk-for-js.

Required Exception If you can't change this file to support the minimum LTS of Node.js, please comment on this issue with the reason and details so we can refine our file search.

#DocIndexProject_nodejs


Document Details

  • Content:
  • Content Source: README.md
  • Service: ****
  • GitHub Login: @
  • Microsoft Alias: ****

train Project of customVisionImgClassify.js doesn't work

When i run the customVisionImgClassify.js, there are a lot of issues. But compare this demo with the official demo on [https://docs.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/quickstarts/object-detection?pivots=programming-language-javascript](docs Microsoft), some issues solved.

But the train project process still has issues whatever I tried, code showed as below:
let trainingIteration = await trainer.trainProject(sampleProject.id);

When i remove await in let trainingIteration = await trainer.trainProject(sampleProject.id); it throw exceptions:
The exceptions:
Creating project...
Adding images...
Training...
Training started...
Training status: undefined
(node:14840) UnhandledPromiseRejectionWarning: Error: iterationId cannot be null or undefined.
at Serializer.serialize (D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:540:19)
at getOperationArgumentValueFromParameterPath (D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:4683:24)
at getOperationArgumentValueFromParameter (D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:4658:12)
at TrainingAPIClient.ServiceClient.sendOperationRequest (D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:4454:45)
at TrainingAPIClient.publishIteration (D:\Technology\web\image_ai\node_modules@azure\cognitiveservices-customvision-training\dist\cognitiveservices-customvision-training.js:3474:25)
at sample (D:\Technology\web\image_ai\customvision\customVisionImgClassify.js:108:19)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14840) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:14840) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:14840) UnhandledPromiseRejectionWarning: Error: Not enough images for training
at new RestError (D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:2433:28)
at D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:3577:37
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14840) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:14840) UnhandledPromiseRejectionWarning: Error: Requests to the CreateImagesFromData Operation under Custom_Vision_Training_3.3 have exceeded rate limit of your current
Custom_Vision.Training F0 pricing tier. Please retry after 1 second. To increase your rate limit switch to a paid tier.
at new RestError (D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:2433:28)
at D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:3577:37
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14840) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
(node:14840) UnhandledPromiseRejectionWarning: Error: Requests to the CreateImagesFromData Operation under Custom_Vision_Training_3.3 have exceeded rate limit of your current
Custom_Vision.Training F0 pricing tier. Please retry after 1 second. To increase your rate limit switch to a paid tier.
at new RestError (D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:2433:28)
at D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:3577:37
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14840) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 11)
(node:14840) UnhandledPromiseRejectionWarning: Error: Requests to the CreateImagesFromData Operation under Custom_Vision_Training_3.3 have exceeded rate limit of your current
Custom_Vision.Training F0 pricing tier. Please retry after 1 second. To increase your rate limit switch to a paid tier.
at new RestError (D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:2433:28)
at D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:3577:37
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14840) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 14)
(node:14840) UnhandledPromiseRejectionWarning: Error: Requests to the CreateImagesFromData Operation under Custom_Vision_Training_3.3 have exceeded rate limit of your current
Custom_Vision.Training F0 pricing tier. Please retry after 1 second. To increase your rate limit switch to a paid tier.
at new RestError (D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:2433:28)
at D:\Technology\web\image_ai\node_modules@azure\ms-rest-js\dist\msRest.node.js:3577:37
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14840) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by r block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandltrict (see htted-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 17) (node:14840) UnhandledPromiseRejectionWarning: Error: Requests to the CreateImagesFromData Operation under Custom_Vision_Training_3.3 have exceeded rate limit of your currentf your current Custom_Vision.Training F0 pricing tier. Please retry after 1 second. To increase your rate limit switch to a paid tier. at new RestError (D:\Technology\web\image_ai\node_modules\@azure\ms-rest-js\dist\msRest.node.js:2433:28) at D:\Technology\web\image_ai\node_modules\@azure\ms-rest-js\dist\msRest.node.js:3577:37 at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:14840) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by r block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandltrict (see htted-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 20)

OS and Version?

Windows 10.

Is there any way to get rid of this to make demo running properly? Please help me with this issue.

Sample of Read Texts in images

Hello
can you please tell me where can I finde a (Package with app.js ) Sample of reading Texts in images i searched in your folder but nothing found. Please, can you send me a link for that?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.