/** * This is just a convenience function. * It's equivalent to {@code forInputValue(ClarifaiVideo.of(videoURL))}. * @param videoURL the video to represent * @return a {@link ClarifaiInput} that represents the given video */ @NotNull public static ClarifaiInput forVideo(@NotNull URL videoURL) { return forInputValue(ClarifaiVideo.of(videoURL)); }
public static ClarifaiInput deserialize(InputOuterClass.Input input) { final DataOuterClass.Data data = input.getData(); final List<Concept> concepts = new ArrayList<>(); for (ConceptOuterClass.Concept concept: data.getConceptsList()) { concepts.add(Concept.deserialize(concept)); } JsonObject metadata = MetadataConverter.structToJsonObject(data.getMetadata()); PointF geoPoint = null; if (data.hasGeo()) { GeoOuterClass.GeoPoint gp = data.getGeo().getGeoPoint(); geoPoint = PointF.at(gp.getLatitude(), gp.getLongitude()); } final List<Region> regions = new ArrayList<>(); for (DataOuterClass.Region region : data.getRegionsList()) { regions.add(Region.deserialize(region)); } return new AutoValue_ClarifaiInput( input.getId(), DateTimeConverter.timestampToDate(input.getCreatedAt()), data.hasVideo() ? ClarifaiVideo.deserialize(data.getVideo()) : ClarifaiImage.deserialize(data.getImage()), metadata, concepts, geoPoint, regions ); }
dataBuilder.setVideo(video.serialize(allowDuplicateURLs)); } else { ClarifaiImage image = (ClarifaiImage) inputValue();
/** * This is just a convenience function. * It's equivalent to {@code forInputValue(ClarifaiVideo.of(videoURL))}. * @param videoURL the video to represent * @return a {@link ClarifaiInput} that represents the given video */ @NotNull public static ClarifaiInput forVideo(@NotNull String videoURL) { return forInputValue(ClarifaiVideo.of(videoURL)); }
@NotNull public static ClarifaiURLVideo of(@NotNull String videoURL) { final URL result; try { result = new URL(videoURL); } catch (MalformedURLException e) { throw new ClarifaiException("Could not parse URL " + videoURL, e); } return of(result); }
/** * This is just a convenience function. * It's equivalent to {@code forInputValue(ClarifaiVideo.of(videoBytes))}. * @param videoBytes the video to represent * @return a {@link ClarifaiInput} that represents the given video */ @NotNull public static ClarifaiInput forVideo(@NotNull byte[] videoBytes) { return forInputValue(ClarifaiVideo.of(videoBytes)); }
/** * This is just a convenience function. * It's equivalent to {@code forInputValue(ClarifaiVideo.of(videoFile))}. * @param videoFile the video to represent * @return a {@link ClarifaiInput} that represents the given video */ @NotNull public static ClarifaiInput forVideo(@NotNull File videoFile) { return forInputValue(ClarifaiVideo.of(videoFile)); }
@NotNull public static ClarifaiFileVideo of(@NotNull File videoFile) { return of(InternalUtil.read(videoFile)); }