简体   繁体   中英

Is there a way to use Googles AutoML with JavaScript?

I trained a model using AutoML Natural Language on Googles Cloud Platform. Now i need to call the AI via JavaScript to do a sentiment analysis, using my own model.

My goal is to embed the whole thing into a website. There i'll have a input form to analyze text. That's all for now actually.

I wasn't able to find anything relating that use case when i did my research. Google provides a REST API but there is literally no tutorial on how to handle it.

Sorry, I know this might not meet the stackoverflow requirements for a question. But I'm totally puzzled.

This is what the REST API looks like:

export GOOGLE_APPLICATION_CREDENTIALS=key-file-path

curl -X POST \
  -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
  -H "Content-Type: application/json" \
  https://automl.googleapis.com/v1beta1/projects/*myProjectID/locations/us-central1/models/*myModelID*:predict \
  -d '{
        "payload" : {
          "textSnippet": {
               "content": "YOUR TEXT HERE",
                "mime_type": "text/plain"
           },
        }
      }'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM