Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : Resource does not exist" #141

Open
NaeemKhan333 opened this issue Oct 21, 2021 · 6 comments
Open

Error : Resource does not exist" #141

NaeemKhan333 opened this issue Oct 21, 2021 · 6 comments

Comments

@NaeemKhan333
Copy link

NaeemKhan333 commented Oct 21, 2021

I am running this command on my terminal

curl -X POST   -H "Authorization: Key xyz"   -H "Content-Type: application/json"   -d '
  {
    "searches": [
      {
        "query": {
        "ranks": [
            {
            "annotation": {
                "data": {
                "image": {
                    "url": "https://samples.clarifai.com/metro-north.jpg"
                }
                }
            }
            }
        ]
        }
      }
    ]
  }' https://api.clarifai.com/v2/annnotations/searches

Facing this following error

{
    "status": {
        "code": 11101,
        "description": "Resource does not exist",
        "details": "Not Found"
    }
}

Please guide me about it. Thanks

@johntorcivia
Copy link
Contributor

Hi @NaeemKhan333 , what are you trying to do? Is this an example directly from the docs somewhere? I'm more familiar with the gRPC implementations but I can try to track down what is going on,

@NaeemKhan333
Copy link
Author

NaeemKhan333 commented Oct 22, 2021

@johntorcivia I have added the images in the images collection of clarifAI app using curl
This is the link

https://docs.clarifai.com/api-guide/search/index-images-for-search
Look in the Search by visual similarity section

You can use images to search through your collection. The API will return ranked results based on how similar the results are to the image you provided in your query.

Search by image URL

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
  {
    "inputs": [
      {
        "data": {
          "image": {
            "url": "https://samples.clarifai.com/metro-north.jpg",
            "allow_duplicate_url": true
          }
        }
      },
      {
        "data": {
          "image": {
            "url": "https://samples.clarifai.com/wedding.jpg",
            "allow_duplicate_url": true
          }
        }
      }
    ]
  }'\
  https://api.clarifai.com/v2/inputs
# Use image's "base64" field to upload image from your local machine.

It adds the images in the Clarifai app.

Now I want to test this using the following command
I want to send my image and want to get similar images from that collection which I created using the above command for adding the images.

https://docs.clarifai.com/api-guide/search/rank

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
  {
    "searches": [
      {
        "query": {
        "ranks": [
            {
            "annotation": {
                "data": {
                "image": {
                    "url": "{YOUR_IMAGE_URL}"
                }
                }
            }
            }
        ]
        }
      }
    ]
  }'\
  https://api.clarifai.com/v2/annnotations/searches

It is giving me above error , can you help me out .

@NaeemKhan333
Copy link
Author

I have resolved the above issue using the command in the following link

Added the images in the App Data collection of Clarifai API using the following command

Link: https://docs.clarifai.com/api-guide/search/index-images-for-search

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
  {
    "inputs": [
      {
        "data": {
          "image": {
            "url": "https://samples.clarifai.com/metro-north.jpg",
            "allow_duplicate_url": true
          }
        }
      },
      {
        "data": {
          "image": {
            "url": "https://samples.clarifai.com/wedding.jpg",
            "allow_duplicate_url": true
          }
        }
      }
    ]
  }'\
  https://api.clarifai.com/v2/inputs
# Use image's "base64" field to upload image from your local machine.

Find Similar Images from App Image Data Collection of ClarifAI API

Using the following link, you can send your image and get similar images from that collection which is created using the above command by adding your images.

Link: https://docs.clarifai.com/api-guide/search/search-1/rank

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
  {
    "query": {
      "ands": [
        {
          "output":{
            "input":{
              "data": {
                "image": {
                  "url": "{YOUR_IMAGE_URL}"
                }
              }
            }
          }
        }
      ]
    }
  }'\
  https://api.clarifai.com/v2/searches

It works fine with Image's URL, now I want to use base64 methods for adding images into App collection and "Search Image from the collection by sending image" through my machine. Can you help me how I can use base64 method because I am facing an error

{"status":{"code":11102,"description":"Invalid request","details":"Malformed or invalid request"}}(base)

@NaeemKhan333
Copy link
Author

@johntorcivia How to send Base64 image to get the response of visual similarity from Image Data collection?

@johntorcivia
Copy link
Contributor

johntorcivia commented Oct 25, 2021

Hi @NaeemKhan333 . You should be able to use the command in the following way to send via base64 instead of URL:

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
  {
    "query": {
      "ands": [
        {
          "output":{
            "input":{
              "data": {
                "image": {
                  "base64": "<base64 image>"
                }
              }
            }
          }
        }
      ]
    }
  }'\
  https://api.clarifai.com/v2/searches

@johntorcivia
Copy link
Contributor

You can see an example of how "input" is constructed here, with base64 (even though it is a different command, the 'input' structure is the same across the entire API): https://docs.clarifai.com/api-guide/predict/images#via-bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants