All Downloads are FREE. Search and download functionalities are using the official Maven repository.

clarifai2.dto.prediction.Frame Maven / Gradle / Ivy

The newest version!
package clarifai2.dto.prediction;

import clarifai2.internal.grpc.api.ConceptOuterClass;
import clarifai2.internal.grpc.api.DataOuterClass;
import com.google.auto.value.AutoValue;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

@SuppressWarnings("NullableProblems")
@AutoValue
public abstract class Frame extends Prediction {

  Frame() {} // AutoValue instances only

  public abstract int index();

  public abstract long time();

  @NotNull public abstract List concepts();


  @NotNull public static Frame deserialize(DataOuterClass.Frame frame) {
    List concepts = new ArrayList<>();
    for (ConceptOuterClass.Concept concept : frame.getData().getConceptsList()) {
      concepts.add(Concept.deserialize(concept));
    }
    return new AutoValue_Frame(
        frame.getFrameInfo().getIndex(),
        frame.getFrameInfo().getTime(),
        concepts
    );
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy