Add option for running ffmpeg_microphone_live as a background process (#32838)
* Add option for running ffmpeg_microphone_live as a background process * Code quality checks for audio_utils * Code clean up for audio_utils * Fixing logic in ffmpeg_microphone calls in audio_utils * Allowing any arbitrary arguments to be passed to ffmpeg_microphone_live * Formatting * Fixing last problems with adding ffmpeg_additional_args * Fixing default arguments and formatting issues * Fixing comments for ffmpeg_additional_args * Adding two shorts tests for ffmpeg_microphone_live * Fixing test bug
This commit is contained in:
@@ -33,7 +33,7 @@ from transformers import (
|
||||
WhisperForConditionalGeneration,
|
||||
)
|
||||
from transformers.pipelines import AutomaticSpeechRecognitionPipeline, pipeline
|
||||
from transformers.pipelines.audio_utils import chunk_bytes_iter
|
||||
from transformers.pipelines.audio_utils import chunk_bytes_iter, ffmpeg_microphone_live
|
||||
from transformers.pipelines.automatic_speech_recognition import _find_timestamp_sequence, chunk_iter
|
||||
from transformers.testing_utils import (
|
||||
compare_pipeline_output_to_hub_spec,
|
||||
@@ -1989,3 +1989,11 @@ class AudioUtilsTest(unittest.TestCase):
|
||||
)
|
||||
with self.assertRaises(StopIteration):
|
||||
next(iter_)
|
||||
|
||||
def test_ffmpeg_no_additional_args(self):
|
||||
mic = ffmpeg_microphone_live(16000, 2.0)
|
||||
mic.close()
|
||||
|
||||
def test_ffmpeg_additional_args(self):
|
||||
mic = ffmpeg_microphone_live(16000, 2.0, ffmpeg_additional_args=["-nostdin"])
|
||||
mic.close()
|
||||
|
||||
Reference in New Issue
Block a user