Big geez
Big geez

Reputation: 39

Clarifai Face Detect Model - 400 Bad Request error

I'm trying to use the Clarifai face detection model but I having some serious problems with the API.

It used to work roughly 6/10 times a couple weeks ago (even if I used the same image without changing anything it only randomly worked sometimes) but now I get: Failed to load resource: the api.clarifai.com/v2/models/searches:1 server responded with a status of 400 (Bad Request) every single time I try to make a request and I haven't changed anything since last time.

When I check my network tab, I see a response of

{"status":{"code":11100,"description":"Bad request format","details":"Query must contain at least one of 'name', 'type', or 'model_type_id'. Check your request fields.","req_id":"ace310ecadbd40e1acce939f96ee8bf5"},"models":[]}

This is the method that I initially had - which was working earlier and is no longer working anymore

    app.models
      .predict(
        Clarifai.FACE_DETECT_MODEL, 
        this.state.input)
      .then(response => {
        if (response) {
          fetch('http://localhost:3000/image', {
            method:'put',
            headers: {'Content-Type': 'application/json'},
            body: JSON.stringify({
              id: this.state.user.id,
            })
          })
            .then(response=>response.json())
            .then(count => {
              this.setState({users: {
                entries: count
              }})
            })

The second method that I used was from a similar StackOverflow question: Clarifai - FACE DETECT - Model does not exist

I only changed what's inside .predict()

    app.models
      .predict(
        {
          model_id: 'a403429f2ddf4b49b307e318f00e528b',
          version_id: '34ce21a40cc24b6b96ffee54aabff139'
        
        },
         
        this.state.input)
      .then(response => {
        if (response) {
          fetch('http://localhost:3000/image', {
            method:'put',
            headers: {'Content-Type': 'application/json'},
            body: JSON.stringify({
              id: this.state.user.id,
            })
          })
            .then(response=>response.json())
            .then(count => {
              this.setState({users: {
                entries: count
              }})
            })


        }

I would appreciate any help at all!

EDIT: when I use FACE_DETECTION_MODEL instead of FACE_DETECT_MODEL I get a plethora of errors in my console.

enter image description here

enter image description here

Upvotes: 0

Views: 963

Answers (1)

Clarifai Support
Clarifai Support

Reputation: 184

Could you please try replacing FACE_DETECT_MODEL to FACE_DETECTION_MODEL

Upvotes: 0

Related Questions