ixxan commited on
Commit
64601f3
·
verified ·
1 Parent(s): f23608f

Update asr.py

Browse files
Files changed (1) hide show
  1. asr.py +4 -4
asr.py CHANGED
@@ -6,16 +6,16 @@ from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
6
  processor = AutoProcessor.from_pretrained("ixxan/whisper-small-ug-cv-15")
7
  model = AutoModelForSpeechSeq2Seq.from_pretrained("ixxan/whisper-small-ug-cv-15")
8
 
9
- def transcribe(audio_path: str) -> str:
 
10
  """
11
  Transcribes audio to text using the Whisper model for Uyghur.
12
-
13
  Args:
14
- - audio_path (str): Path to the audio file to transcribe.
15
-
16
  Returns:
17
  - str: The transcription of the audio.
18
  """
 
19
 
20
  # Load audio file
21
  audio_input, sampling_rate = torchaudio.load(audio_path)
 
6
  processor = AutoProcessor.from_pretrained("ixxan/whisper-small-ug-cv-15")
7
  model = AutoModelForSpeechSeq2Seq.from_pretrained("ixxan/whisper-small-ug-cv-15")
8
 
9
+
10
+ def transcribe(audio_data: tuple) -> str:
11
  """
12
  Transcribes audio to text using the Whisper model for Uyghur.
 
13
  Args:
14
+ - audio_data (tuple): Gradio audio input (file path and sample rate).
 
15
  Returns:
16
  - str: The transcription of the audio.
17
  """
18
+ audio_path = audio_data[0] # Extract the file path from the tuple
19
 
20
  # Load audio file
21
  audio_input, sampling_rate = torchaudio.load(audio_path)