Example #1
0
    def test_predict(self, art_warning, audio_data):
        try:
            test_input = audio_data

            lingvo = TensorFlowLingvoASR()
            predictions = lingvo.predict(test_input, batch_size=2)
            assert predictions.shape == test_input.shape
            assert isinstance(predictions[0], np.str_)
        except ARTTestException as e:
            art_warning(e)
Example #2
0
    def test_predict(self, art_warning, audio_data):
        try:
            import tensorflow.compat.v1 as tf1

            tf1.reset_default_graph()

            test_input = audio_data

            lingvo = TensorFlowLingvoASR()
            predictions = lingvo.predict(test_input, batch_size=2)
            assert predictions.shape == test_input.shape
            assert isinstance(predictions[0], np.str_)
        except ARTTestException as e:
            art_warning(e)
Example #3
0
    def test_predict(self, art_warning):
        try:
            transcripts = list()
            audios = list()
            for filename, sample in self.samples.items():
                file_path = get_file(filename, sample["uri"])
                _, audio = read(file_path)
                audios.append(audio)
                transcripts.append(sample["transcript"])

            audio_batch = np.array(audios, dtype=object)

            lingvo = TensorFlowLingvoASR()
            prediction = lingvo.predict(audio_batch, batch_size=1)
            assert prediction[0] == transcripts[0]
        except ARTTestException as e:
            art_warning(e)