有没有办法在 JavaScript 中使用 Googles AutoML? [英] Is there a way to use Googles AutoML with JavaScript?

查看:65
本文介绍了有没有办法在 JavaScript 中使用 Googles AutoML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Google 云平台上使用 AutoML Natural Language 训练了一个模型.现在我需要通过 JavaScript 调用 AI 来使用我自己的模型进行情绪分析.

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.

我在进行研究时找不到与该用例相关的任何内容.Google 提供了 REST API,但实际上没有关于如何处理它的教程.

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.

抱歉,我知道这可能不符合问题的 stackoverflow 要求.但我完全不解.

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

这是 REST API 的样子:

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"
           },
        }
      }'

推荐答案

给你!并请检查完整的回购.

Here you go! and please check the full repo.

https://github.com/googleapis/nodejs-vision/blob/master/samples/automl/automlVisionPredict.js

这篇关于有没有办法在 JavaScript 中使用 Googles AutoML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆