File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ public void TextToAudioPipeline_Generate()
141141 public void AutomaticSpeechRecognitionPipeline_Transcribe ( )
142142 {
143143 var pipeline = AutomaticSpeechRecognitionPipeline . FromModel ( "openai/whisper-tiny" ) ;
144- var audioPath = "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac" ; // Replace with a valid audio path
144+ var audioPath = "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac" ;
145145 var result = pipeline . Transcribe ( audioPath ) ;
146146 Assert . NotNull ( result ) ;
147147 Assert . NotEmpty ( result ) ;
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public static SpeechToTextClient FromModel(string model, TorchDtype? torchDtype
1818
1919 public void Dispose ( )
2020 {
21- // Nothing to do right now
21+ // Nothing to do right now. ASR pipeline object will be collected via next GC pass anyway.
2222 }
2323
2424 public object ? GetService ( Type serviceType , object ? serviceKey = null ) =>
Original file line number Diff line number Diff line change @@ -157,14 +157,26 @@ def invoke_text_to_audio_pipeline(pipeline: Pipeline,
157157
158158def invoke_automatic_speech_recognition_pipeline (pipeline : Pipeline , audio : str ) -> str :
159159 """
160- Invoke an automatic speech recognition pipeline.
160+ Invoke an automatic speech recognition pipeline and return the result.
161+
162+ Args:
163+ pipeline: The ASR pipeline object
164+ audio: A local file path or a URL
165+ Returns:
166+ The text detected
161167 """
162168 r = pipeline (audio , return_timestamps = False )
163169 return r ['text' ]
164170
165171def invoke_automatic_speech_recognition_pipeline_from_bytes (pipeline : Pipeline , audio : bytes ) -> str :
166172 """
167- Invoke an automatic speech recognition pipeline.
173+ Invoke an automatic speech recognition pipeline and return the result.
174+
175+ Args:
176+ pipeline: The ASR pipeline object
177+ audio: The bytes of the audio file
178+ Returns:
179+ The text detected
168180 """
169181 r = pipeline (audio , return_timestamps = False )
170182 return r ['text' ]
You can’t perform that action at this time.
0 commit comments