Spaces:
Sleeping
Sleeping
Update asr.py
Browse files
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 |
-
|
|
|
10 |
"""
|
11 |
Transcribes audio to text using the Whisper model for Uyghur.
|
12 |
-
|
13 |
Args:
|
14 |
-
-
|
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)
|