Request ModelResourcesGraphService for all Task API web graphs.
PiperOrigin-RevId: 508681004
This commit is contained in:
parent
915d2c7417
commit
39a943e91e
|
@ -84,9 +84,6 @@ export abstract class TaskRunner {
|
|||
// Disables the automatic render-to-screen code, which allows for pure
|
||||
// CPU processing.
|
||||
this.graphRunner.setAutoRenderToScreen(false);
|
||||
|
||||
// Enables use of our model resource caching graph service.
|
||||
this.graphRunner.registerModelResourcesGraphService();
|
||||
}
|
||||
|
||||
/** Configures the task with custom options. */
|
||||
|
@ -149,6 +146,11 @@ export abstract class TaskRunner {
|
|||
this.graphRunner.attachErrorListener((code, message) => {
|
||||
this.processingErrors.push(new Error(message));
|
||||
});
|
||||
|
||||
// Enables use of our model resource caching graph service; we apply this to
|
||||
// every MediaPipe graph we run.
|
||||
this.graphRunner.registerModelResourcesGraphService();
|
||||
|
||||
this.graphRunner.setGraph(graphData, isBinary);
|
||||
this.handleErrors();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ class TaskRunnerFake extends TaskRunner {
|
|||
'registerModelResourcesGraphService', 'attachErrorListener'
|
||||
]));
|
||||
const graphRunner = this.graphRunner as jasmine.SpyObj<CachedGraphRunner>;
|
||||
expect(graphRunner.registerModelResourcesGraphService).toHaveBeenCalled();
|
||||
expect(graphRunner.setAutoRenderToScreen).toHaveBeenCalled();
|
||||
graphRunner.attachErrorListener.and.callFake(listener => {
|
||||
this.errorListener = listener;
|
||||
|
@ -65,6 +64,8 @@ class TaskRunnerFake extends TaskRunner {
|
|||
|
||||
override setGraph(graphData: Uint8Array, isBinary: boolean): void {
|
||||
super.setGraph(graphData, isBinary);
|
||||
expect(this.graphRunner.registerModelResourcesGraphService)
|
||||
.toHaveBeenCalled();
|
||||
}
|
||||
|
||||
setOptions(options: TaskRunnerOptions): Promise<void> {
|
||||
|
|
Loading…
Reference in New Issue
Block a user