Update tests and demos to call "close".

PiperOrigin-RevId: 527746909
This commit is contained in:
Sebastian Schmidt 2023-04-27 18:56:55 -07:00 committed by Copybara-Service
parent 28b9b8d8a3
commit 5d9761cbfd
15 changed files with 60 additions and 0 deletions

View File

@ -86,6 +86,10 @@ describe('AudioClassifier', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
audioClassifier.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(audioClassifier); verifyGraph(audioClassifier);
verifyListenersRegistered(audioClassifier); verifyListenersRegistered(audioClassifier);

View File

@ -76,6 +76,10 @@ describe('AudioEmbedder', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
audioEmbedder.close();
});
it('initializes graph', () => { it('initializes graph', () => {
verifyGraph(audioEmbedder); verifyGraph(audioEmbedder);
verifyListenersRegistered(audioEmbedder); verifyListenersRegistered(audioEmbedder);

View File

@ -62,6 +62,10 @@ describe('LanguageDetector', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
languageDetector.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(languageDetector); verifyGraph(languageDetector);
verifyListenersRegistered(languageDetector); verifyListenersRegistered(languageDetector);

View File

@ -61,6 +61,10 @@ describe('TextClassifier', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
textClassifier.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(textClassifier); verifyGraph(textClassifier);
verifyListenersRegistered(textClassifier); verifyListenersRegistered(textClassifier);

View File

@ -61,6 +61,10 @@ describe('TextEmbedder', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
textEmbedder.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(textEmbedder); verifyGraph(textEmbedder);
verifyListenersRegistered(textEmbedder); verifyListenersRegistered(textEmbedder);

View File

@ -66,6 +66,10 @@ describe('FaceDetector', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
faceDetector.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(faceDetector); verifyGraph(faceDetector);
verifyListenersRegistered(faceDetector); verifyListenersRegistered(faceDetector);

View File

@ -94,6 +94,10 @@ describe('FaceLandmarker', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
faceLandmarker.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(faceLandmarker); verifyGraph(faceLandmarker);
verifyListenersRegistered(faceLandmarker); verifyListenersRegistered(faceLandmarker);

View File

@ -66,6 +66,10 @@ describe('FaceStylizer', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
faceStylizer.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(faceStylizer); verifyGraph(faceStylizer);
verifyListenersRegistered(faceStylizer); verifyListenersRegistered(faceStylizer);

View File

@ -113,6 +113,10 @@ describe('GestureRecognizer', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
gestureRecognizer.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(gestureRecognizer); verifyGraph(gestureRecognizer);
verifyListenersRegistered(gestureRecognizer); verifyListenersRegistered(gestureRecognizer);

View File

@ -83,6 +83,10 @@ describe('HandLandmarker', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
handLandmarker.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(handLandmarker); verifyGraph(handLandmarker);
verifyListenersRegistered(handLandmarker); verifyListenersRegistered(handLandmarker);

View File

@ -66,6 +66,10 @@ describe('ImageClassifier', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
imageClassifier.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(imageClassifier); verifyGraph(imageClassifier);
verifyListenersRegistered(imageClassifier); verifyListenersRegistered(imageClassifier);

View File

@ -62,6 +62,10 @@ describe('ImageEmbedder', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
imageEmbedder.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(imageEmbedder); verifyGraph(imageEmbedder);
verifyListenersRegistered(imageEmbedder); verifyListenersRegistered(imageEmbedder);

View File

@ -68,6 +68,10 @@ describe('ImageSegmenter', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
imageSegmenter.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(imageSegmenter); verifyGraph(imageSegmenter);

View File

@ -84,6 +84,10 @@ describe('InteractiveSegmenter', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
interactiveSegmenter.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(interactiveSegmenter); verifyGraph(interactiveSegmenter);

View File

@ -66,6 +66,10 @@ describe('ObjectDetector', () => {
{baseOptions: {modelAssetBuffer: new Uint8Array([])}}); {baseOptions: {modelAssetBuffer: new Uint8Array([])}});
}); });
afterEach(() => {
objectDetector.close();
});
it('initializes graph', async () => { it('initializes graph', async () => {
verifyGraph(objectDetector); verifyGraph(objectDetector);
verifyListenersRegistered(objectDetector); verifyListenersRegistered(objectDetector);