Remove error check that canvas must be defined

PiperOrigin-RevId: 529906685
This commit is contained in:
Sebastian Schmidt 2023-05-05 23:20:22 -07:00 committed by Copybara-Service
parent 6aad5742c3
commit fb7f06b509

View File

@ -59,11 +59,6 @@ export abstract class VisionTaskRunner extends TaskRunner {
protected static async createVisionInstance<T extends VisionTaskRunner>( protected static async createVisionInstance<T extends VisionTaskRunner>(
type: WasmMediaPipeConstructor<T>, fileset: WasmFileset, type: WasmMediaPipeConstructor<T>, fileset: WasmFileset,
options: VisionTaskOptions): Promise<T> { options: VisionTaskOptions): Promise<T> {
if (options.baseOptions?.delegate === 'GPU') {
if (!options.canvas) {
throw new Error('You must specify a canvas for GPU processing.');
}
}
const canvas = options.canvas ?? createCanvas(); const canvas = options.canvas ?? createCanvas();
return TaskRunner.createInstance(type, canvas, fileset, options); return TaskRunner.createInstance(type, canvas, fileset, options);
} }