Rank
Search your data based on concepts or visual similarity
Search By Concepts
By clarifai/main App Concepts
import com.clarifai.grpc.api.*;
import com.clarifai.grpc.api.status.*;
// Insert here the initialization code as outlined on this page:
// https://docs.clarifai.com/api-guide/api-overview
MultiSearchResponse postAnnotationsSearchesResponse = stub.postAnnotationsSearches(
PostAnnotationsSearchesRequest.newBuilder().addSearches(
Search.newBuilder().setQuery(
Query.newBuilder().addRanks(
Rank.newBuilder().setAnnotation(
Annotation.newBuilder().setData(
Data.newBuilder().addConcepts( // You can search by multiple concepts.
Concept.newBuilder()
.setId("people") // You could search by concept Name as well.
.setValue(1f) // Value of 0 will search for images that don't have the concept.
)
)
)
)
)
)
.build()
);
if (postAnnotationsSearchesResponse.getStatus().getCode() != StatusCode.SUCCESS) {
throw new RuntimeException("Post annotations searches failed, status: " + postAnnotationsSearchesResponse.getStatus());
}
System.out.println("Found inputs " + postAnnotationsSearchesResponse.getHitsCount() + ":");
for (Hit hit : postAnnotationsSearchesResponse.getHitsList()) {
System.out.printf("\tScore %.2f for annotation % of input %s\n", hit.getScore(), hit.getAnnotation().getId(), hit.getInput().getId())
}By Custom Concepts
By clarifai/main and custom concepts
By concept in another language
Search by visual similarity
Search by image URL
Search by image Bytes
By Input ID
Last updated
Was this helpful?