List of usage examples for com.amazonaws.services.rekognition.model DetectModerationLabelsRequest DetectModerationLabelsRequest
DetectModerationLabelsRequest
From source file:org.nuxeo.vision.aws.AmazonRekognitionProvider.java
License:Apache License
@Override public List<VisionResponse> execute(List<Blob> blobs, List<String> features, int maxResults) throws IOException, GeneralSecurityException, IllegalStateException { List<VisionResponse> result = new ArrayList<>(); for (Blob blob : blobs) { result.add(/*from www .j av a 2 s . c om*/ new AmazonRekognitionResponse( getClient().detectLabels(new DetectLabelsRequest() .withImage(new com.amazonaws.services.rekognition.model.Image() .withBytes(ByteBuffer.wrap(blob.getByteArray()))) .withMaxLabels(maxResults)))); // different API on AWS Rekognition for safe content detection if (features.contains(VisionFeature.SAFE_SEARCH_DETECTION.toString())) { result.add(new AmazonRekognitionResponse( getClient().detectModerationLabels(new DetectModerationLabelsRequest() .withImage(new com.amazonaws.services.rekognition.model.Image() .withBytes(ByteBuffer.wrap(blob.getByteArray())))))); } } return result; }