From 5d9761cbfd11382800c2d537b8e84e30a88dcd5e Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Thu, 27 Apr 2023 18:56:55 -0700 Subject: [PATCH] Update tests and demos to call "close". PiperOrigin-RevId: 527746909 --- .../tasks/web/audio/audio_classifier/audio_classifier_test.ts | 4 ++++ .../tasks/web/audio/audio_embedder/audio_embedder_test.ts | 4 ++++ .../web/text/language_detector/language_detector_test.ts | 4 ++++ .../tasks/web/text/text_classifier/text_classifier_test.ts | 4 ++++ mediapipe/tasks/web/text/text_embedder/text_embedder_test.ts | 4 ++++ .../tasks/web/vision/face_detector/face_detector_test.ts | 4 ++++ .../tasks/web/vision/face_landmarker/face_landmarker_test.ts | 4 ++++ .../tasks/web/vision/face_stylizer/face_stylizer_test.ts | 4 ++++ .../web/vision/gesture_recognizer/gesture_recognizer_test.ts | 4 ++++ .../tasks/web/vision/hand_landmarker/hand_landmarker_test.ts | 4 ++++ .../web/vision/image_classifier/image_classifier_test.ts | 4 ++++ .../tasks/web/vision/image_embedder/image_embedder_test.ts | 4 ++++ .../tasks/web/vision/image_segmenter/image_segmenter_test.ts | 4 ++++ .../interactive_segmenter/interactive_segmenter_test.ts | 4 ++++ .../tasks/web/vision/object_detector/object_detector_test.ts | 4 ++++ 15 files changed, 60 insertions(+) diff --git a/mediapipe/tasks/web/audio/audio_classifier/audio_classifier_test.ts b/mediapipe/tasks/web/audio/audio_classifier/audio_classifier_test.ts index a0e906095..ba4f4535b 100644 --- a/mediapipe/tasks/web/audio/audio_classifier/audio_classifier_test.ts +++ b/mediapipe/tasks/web/audio/audio_classifier/audio_classifier_test.ts @@ -86,6 +86,10 @@ describe('AudioClassifier', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + audioClassifier.close(); + }); + it('initializes graph', async () => { verifyGraph(audioClassifier); verifyListenersRegistered(audioClassifier); diff --git a/mediapipe/tasks/web/audio/audio_embedder/audio_embedder_test.ts b/mediapipe/tasks/web/audio/audio_embedder/audio_embedder_test.ts index 8c79ceb21..0944e75e6 100644 --- a/mediapipe/tasks/web/audio/audio_embedder/audio_embedder_test.ts +++ b/mediapipe/tasks/web/audio/audio_embedder/audio_embedder_test.ts @@ -76,6 +76,10 @@ describe('AudioEmbedder', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + audioEmbedder.close(); + }); + it('initializes graph', () => { verifyGraph(audioEmbedder); verifyListenersRegistered(audioEmbedder); diff --git a/mediapipe/tasks/web/text/language_detector/language_detector_test.ts b/mediapipe/tasks/web/text/language_detector/language_detector_test.ts index 71ab60a59..94eafb04e 100644 --- a/mediapipe/tasks/web/text/language_detector/language_detector_test.ts +++ b/mediapipe/tasks/web/text/language_detector/language_detector_test.ts @@ -62,6 +62,10 @@ describe('LanguageDetector', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + languageDetector.close(); + }); + it('initializes graph', async () => { verifyGraph(languageDetector); verifyListenersRegistered(languageDetector); diff --git a/mediapipe/tasks/web/text/text_classifier/text_classifier_test.ts b/mediapipe/tasks/web/text/text_classifier/text_classifier_test.ts index 2b22c0006..843745188 100644 --- a/mediapipe/tasks/web/text/text_classifier/text_classifier_test.ts +++ b/mediapipe/tasks/web/text/text_classifier/text_classifier_test.ts @@ -61,6 +61,10 @@ describe('TextClassifier', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + textClassifier.close(); + }); + it('initializes graph', async () => { verifyGraph(textClassifier); verifyListenersRegistered(textClassifier); diff --git a/mediapipe/tasks/web/text/text_embedder/text_embedder_test.ts b/mediapipe/tasks/web/text/text_embedder/text_embedder_test.ts index 7adeeb1b0..53c09826b 100644 --- a/mediapipe/tasks/web/text/text_embedder/text_embedder_test.ts +++ b/mediapipe/tasks/web/text/text_embedder/text_embedder_test.ts @@ -61,6 +61,10 @@ describe('TextEmbedder', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + textEmbedder.close(); + }); + it('initializes graph', async () => { verifyGraph(textEmbedder); verifyListenersRegistered(textEmbedder); diff --git a/mediapipe/tasks/web/vision/face_detector/face_detector_test.ts b/mediapipe/tasks/web/vision/face_detector/face_detector_test.ts index 9f9d00732..28f602965 100644 --- a/mediapipe/tasks/web/vision/face_detector/face_detector_test.ts +++ b/mediapipe/tasks/web/vision/face_detector/face_detector_test.ts @@ -66,6 +66,10 @@ describe('FaceDetector', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + faceDetector.close(); + }); + it('initializes graph', async () => { verifyGraph(faceDetector); verifyListenersRegistered(faceDetector); diff --git a/mediapipe/tasks/web/vision/face_landmarker/face_landmarker_test.ts b/mediapipe/tasks/web/vision/face_landmarker/face_landmarker_test.ts index b6f16a721..7070d1dd7 100644 --- a/mediapipe/tasks/web/vision/face_landmarker/face_landmarker_test.ts +++ b/mediapipe/tasks/web/vision/face_landmarker/face_landmarker_test.ts @@ -94,6 +94,10 @@ describe('FaceLandmarker', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + faceLandmarker.close(); + }); + it('initializes graph', async () => { verifyGraph(faceLandmarker); verifyListenersRegistered(faceLandmarker); diff --git a/mediapipe/tasks/web/vision/face_stylizer/face_stylizer_test.ts b/mediapipe/tasks/web/vision/face_stylizer/face_stylizer_test.ts index 3ef35728d..167fd674e 100644 --- a/mediapipe/tasks/web/vision/face_stylizer/face_stylizer_test.ts +++ b/mediapipe/tasks/web/vision/face_stylizer/face_stylizer_test.ts @@ -66,6 +66,10 @@ describe('FaceStylizer', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + faceStylizer.close(); + }); + it('initializes graph', async () => { verifyGraph(faceStylizer); verifyListenersRegistered(faceStylizer); diff --git a/mediapipe/tasks/web/vision/gesture_recognizer/gesture_recognizer_test.ts b/mediapipe/tasks/web/vision/gesture_recognizer/gesture_recognizer_test.ts index 4b064500e..95ba06cca 100644 --- a/mediapipe/tasks/web/vision/gesture_recognizer/gesture_recognizer_test.ts +++ b/mediapipe/tasks/web/vision/gesture_recognizer/gesture_recognizer_test.ts @@ -113,6 +113,10 @@ describe('GestureRecognizer', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + gestureRecognizer.close(); + }); + it('initializes graph', async () => { verifyGraph(gestureRecognizer); verifyListenersRegistered(gestureRecognizer); diff --git a/mediapipe/tasks/web/vision/hand_landmarker/hand_landmarker_test.ts b/mediapipe/tasks/web/vision/hand_landmarker/hand_landmarker_test.ts index 7499444f4..91cba1f1f 100644 --- a/mediapipe/tasks/web/vision/hand_landmarker/hand_landmarker_test.ts +++ b/mediapipe/tasks/web/vision/hand_landmarker/hand_landmarker_test.ts @@ -83,6 +83,10 @@ describe('HandLandmarker', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + handLandmarker.close(); + }); + it('initializes graph', async () => { verifyGraph(handLandmarker); verifyListenersRegistered(handLandmarker); diff --git a/mediapipe/tasks/web/vision/image_classifier/image_classifier_test.ts b/mediapipe/tasks/web/vision/image_classifier/image_classifier_test.ts index 40e50c531..889de4bca 100644 --- a/mediapipe/tasks/web/vision/image_classifier/image_classifier_test.ts +++ b/mediapipe/tasks/web/vision/image_classifier/image_classifier_test.ts @@ -66,6 +66,10 @@ describe('ImageClassifier', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + imageClassifier.close(); + }); + it('initializes graph', async () => { verifyGraph(imageClassifier); verifyListenersRegistered(imageClassifier); diff --git a/mediapipe/tasks/web/vision/image_embedder/image_embedder_test.ts b/mediapipe/tasks/web/vision/image_embedder/image_embedder_test.ts index 7dc0c32ef..6aa6f11cd 100644 --- a/mediapipe/tasks/web/vision/image_embedder/image_embedder_test.ts +++ b/mediapipe/tasks/web/vision/image_embedder/image_embedder_test.ts @@ -62,6 +62,10 @@ describe('ImageEmbedder', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + imageEmbedder.close(); + }); + it('initializes graph', async () => { verifyGraph(imageEmbedder); verifyListenersRegistered(imageEmbedder); diff --git a/mediapipe/tasks/web/vision/image_segmenter/image_segmenter_test.ts b/mediapipe/tasks/web/vision/image_segmenter/image_segmenter_test.ts index f7d1f1f87..1327c1b3c 100644 --- a/mediapipe/tasks/web/vision/image_segmenter/image_segmenter_test.ts +++ b/mediapipe/tasks/web/vision/image_segmenter/image_segmenter_test.ts @@ -68,6 +68,10 @@ describe('ImageSegmenter', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + imageSegmenter.close(); + }); + it('initializes graph', async () => { verifyGraph(imageSegmenter); diff --git a/mediapipe/tasks/web/vision/interactive_segmenter/interactive_segmenter_test.ts b/mediapipe/tasks/web/vision/interactive_segmenter/interactive_segmenter_test.ts index 3e108309d..0a9477605 100644 --- a/mediapipe/tasks/web/vision/interactive_segmenter/interactive_segmenter_test.ts +++ b/mediapipe/tasks/web/vision/interactive_segmenter/interactive_segmenter_test.ts @@ -84,6 +84,10 @@ describe('InteractiveSegmenter', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + interactiveSegmenter.close(); + }); + it('initializes graph', async () => { verifyGraph(interactiveSegmenter); diff --git a/mediapipe/tasks/web/vision/object_detector/object_detector_test.ts b/mediapipe/tasks/web/vision/object_detector/object_detector_test.ts index a9d951e94..1613f27d7 100644 --- a/mediapipe/tasks/web/vision/object_detector/object_detector_test.ts +++ b/mediapipe/tasks/web/vision/object_detector/object_detector_test.ts @@ -66,6 +66,10 @@ describe('ObjectDetector', () => { {baseOptions: {modelAssetBuffer: new Uint8Array([])}}); }); + afterEach(() => { + objectDetector.close(); + }); + it('initializes graph', async () => { verifyGraph(objectDetector); verifyListenersRegistered(objectDetector);