首页 > 解决方案 > 未能检测到人脸

问题描述

我正在开发一个可以使用 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));
  }


}.

标签: reactjsclarifai

解决方案


您好 Clarifai 支持这里。你能尝试更换吗

FACE_DETECT_MODEL

FACE_DETECTION_MODEL

它可能就像语法错误一样简单。

app.models.predict()

推荐阅读