import ModelShape from '../modelspec/ModelShape'; import ModelSpec from '../modelspec/ModelSpec'; /** * A builder class to instantiate a model spec. */ export default class ModelSpecBuilder { private path; private input; private output; static builder(): ModelSpecBuilder; /** * Set up the builder to use the default model implementation. * * Members of this interface can change without a major version bump to accommodate new browser * bugs and capabilities. If you extend this type, you might need to rework your code for new minor * versions of this library. * @returns a reference to the current builder. */ withDefaultModel(): ModelSpecBuilder; /** * Set up the builder to use the defaults for selfie segmentation model. * @returns the builder to allow for fluent API (e.g., ModelSpecBuilder.withSelfieSegmentationDefaults().build()). */ withSelfieSegmentationDefaults(): ModelSpecBuilder; /** * A method to override the path to the segmentation model. * @param path A function that returns the path to the segmentation model. * @returns the builder to allow for fluent API (e.g., ModelSpecBuilder.builder().withPath("some path").build()). */ withPath(path: string): ModelSpecBuilder; /** * A method to override the input shape to the segmentation model. * @param input An object that defines input shape of the segmentation model. * @returns the builder to allow for fluent API (e.g., ModelSpecBuilder.builder().withInput({}).build()). */ withInput(input: ModelShape): ModelSpecBuilder; /** * A method to override the output shape to the segmentation model. * @param output An object that defines output shape of the segmentation model. * @returns the builder to allow for fluent API (e.g., ModelSpecBuilder.builder().withOutput({}).build()). */ withOutput(output: ModelShape): ModelSpecBuilder; /** * Validate that inputs to the model spec are valid. */ private validate; /** * A method that returns an instantiated object that implements the ModelSpec interface with values set for * the use of the selfie segmentation model. * @returns an object that implements the ModelSpec interface. */ build(): ModelSpec; }