我正在研究可以使用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));
}
}.
答案 0 :(得分:1)
您好Clarifai在这里支持。您能不能尝试更换
FACE_DETECT_MODEL
使用
FACE_DETECTION_MODEL
它可能就像语法错误一样简单。
在
app.models.predict()