@NotNull public static ClarifaiFileVideo of(@NotNull byte[] videoBytes) { return new AutoValue_ClarifaiFileVideo(Crop.create(), videoBytes); }
@NotNull public static ClarifaiURLVideo of(@NotNull URL videoURL) { return new AutoValue_ClarifaiURLVideo(Crop.create(), videoURL); }
@NotNull public static ClarifaiFileImage of(@NotNull byte[] imageBytes) { return new AutoValue_ClarifaiFileImage(Crop.create(), imageBytes); }
@NotNull public static ClarifaiURLImage of(@NotNull URL imageURL) { return new AutoValue_ClarifaiURLImage(Crop.create(), imageURL); }
@Retry @Test public void t16b_predictWithModel_00() { assertSuccess(client.getDefaultModels().generalModel().predict() .withInputs(ClarifaiInput.forInputValue(ClarifaiImage.of(METRO_NORTH_IMAGE_URL) .withCrop(Crop.create() .top(0.1F) .bottom(0.8F) ) ))); }
@Test public void cropping() { client.addInputs() .plus( ClarifaiInput.forInputValue( ClarifaiImage.of("@@sampleTrain") .withCrop(Crop.create() .top(0.2F) .left(0.4F) .bottom(0.3F) .right(0.6F) ) ) ) .allowDuplicateURLs(true) .executeSync(); }
@Test public void shouldSucceedWhenValidRequestWithFaceFeedback() { ModelFeedbackRequest request = client.modelFeedback(client.getDefaultModels().travelModel().id()) .withInputId("@inputId") .withImageUrl(FAMILY_IMAGE_URL) .withRegions( RegionFeedback.make( Crop.create().top(0.1f).bottom(0.2f).left(0.3f).right(0.4f), Feedback.ACCURATE ) .withFaceFeedback( FaceFeedback.make( Arrays.asList(ConceptFeedback.forIdAndValue("face", true)), Arrays.asList(ConceptFeedback.forIdAndValue("face", true)) ) )) .withEndUserId("@endUserId") .withSessionId("@sessionId") .withEventType("annotation") .withOutputId("@outputId"); assertSuccess(request); } }
@Retry @Test public void t01a_addInputs() throws Exception { assertSuccess(client.addInputs() .plus(ClarifaiInput.forInputValue(ClarifaiImage.of(KOTLIN_LOGO_IMAGE_FILE) .withCrop(Crop.create() .top(0.1F) .left(0.1F) .bottom(0.9F) .right(0.9F) ) ) .withID("foo1") .withConcepts(Concept.forID("concept1").withValue(false)) ) ); }
@Test public void shouldSucceedWhenValidRequestWithRegions() { ModelFeedbackRequest request = client.modelFeedback(client.getDefaultModels().travelModel().id()) .withInputId("@inputId") .withImageUrl(FAMILY_IMAGE_URL) .withRegions( RegionFeedback.make( Crop.create().top(0.1f).bottom(0.2f).left(0.3f).right(0.4f), Feedback.ACCURATE ) .withConceptFeedbacks(ConceptFeedback.forIdAndValue("car", false))) .withEndUserId("@endUserId") .withSessionId("@sessionId") .withEventType("annotation") .withOutputId("@outputId"); assertSuccess(request); }