reactjs - 未能检测到人脸
问题描述
我正在开发一个可以使用 Clarifai api 检测图像的应用程序。我创建了所有组件,但无论何时我发布它都会显示
api.clarifai.com/v2/models/a403429f2ddf4b49b307e318f00e528b/outputs:1 POST https://api.clarifai.com/v2/models/a403429f2ddf4b49b307e318f00e528b/outputs 400(错误请求)
我已经尝试生成新的 API,但没有一个有效发布在这里输入代码
import React, {Component} from 'react';
import Clarifai from 'clarifai';
const app = new Clarifai.App({
apiKey: 'b7712f2f841c4482bb85e68f02cdf4b6'
});
onButtonSubmit = () => {
this.setState({imageUrl: this.state.input});
app.models
.predict(
Clarifai.FACE_DETECT_MODEL,
this.state.input)
.then(response => {
if (response) {
fetch('http://localhost:3001/image', {
method: 'put',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: this.state.user.id
})
})
.then(response => response.json())
.then(count => {
this.setState(Object.assign(this.state.user, { entries: count}))
})
}
this.displayFaceBox(this.calculateFaceLocation(response))
})
.catch(err => console.log(err));
}
}.
解决方案
您好 Clarifai 支持这里。你能尝试更换吗
FACE_DETECT_MODEL
和
FACE_DETECTION_MODEL
它可能就像语法错误一样简单。
在
app.models.predict()
推荐阅读
- django - 在 Pycharm 上使用 Python 3.7 给了我:“错误:Django 在此环境中不可导入”
- puppeteer - 如何 page.click 一个 ember.js 计算元素?
- serialization - 如何使用 newtonsoft.json 反序列化复杂对象列表
- javascript - Javascript切片方法,从某个word.s开始
- javascript - 试图弄清楚如何安装这个 jquery 脚本
- azure - 使用 asp.net 核心在 F1/D1 Azure 计划中生成 PDF
- python - lxml - 多个根和格式问题
- c# - 用特定模式填充矩阵
- mysql - MySQL:两边的TRIM空格和换行符
- c# - 仅增量到特定数字然后开始增量