Update asr.py
Browse files
asr.py
CHANGED
@@ -15,6 +15,10 @@ def transcribe(audio):
|
|
15 |
|
16 |
audio_samples = librosa.load(audio, sr=ASR_SAMPLING_RATE, mono=True)[0]
|
17 |
inputs = processor(audio_samples, sampling_rate=ASR_SAMPLING_RATE, return_tensors="pt")
|
|
|
|
|
|
|
|
|
18 |
|
19 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
20 |
model.to(device)
|
|
|
15 |
|
16 |
audio_samples = librosa.load(audio, sr=ASR_SAMPLING_RATE, mono=True)[0]
|
17 |
inputs = processor(audio_samples, sampling_rate=ASR_SAMPLING_RATE, return_tensors="pt")
|
18 |
+
|
19 |
+
# Set language ID for Faroese
|
20 |
+
language_id = 'fao' # ISO 639-3 code for Faroese
|
21 |
+
processor.tokenizer.set_lang(language_id)
|
22 |
|
23 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
24 |
model.to(device)
|