Spaces:
Running
Running
Irpan
commited on
Commit
·
70da837
1
Parent(s):
cafc4cf
asr
Browse files
asr.py
CHANGED
@@ -32,11 +32,11 @@ models_info = {
|
|
32 |
"model": AutoModelForCTC.from_pretrained("facebook/mms-1b-all", target_lang='uig-script_arabic', ignore_mismatched_sizes=True),
|
33 |
"ctc_model": True
|
34 |
},
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
}
|
41 |
|
42 |
def transcribe(audio_data, model_id) -> str:
|
@@ -76,7 +76,7 @@ def transcribe(audio_data, model_id) -> str:
|
|
76 |
audio_input = resampler(audio_input)
|
77 |
|
78 |
# Preprocess the audio input
|
79 |
-
inputs = processor(audio_input.squeeze(), sampling_rate=target_sr, return_tensors="pt"
|
80 |
|
81 |
# Move model to GPU if available
|
82 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
32 |
"model": AutoModelForCTC.from_pretrained("facebook/mms-1b-all", target_lang='uig-script_arabic', ignore_mismatched_sizes=True),
|
33 |
"ctc_model": True
|
34 |
},
|
35 |
+
"ixxan/wav2vec2-large-mms-1b-uyghur-latin": {
|
36 |
+
"processor": Wav2Vec2Processor.from_pretrained("ixxan/wav2vec2-large-mms-1b-uyghur-latin", target_lang='uig-script_latin'),
|
37 |
+
"model": Wav2Vec2ForCTC.from_pretrained("ixxan/wav2vec2-large-mms-1b-uyghur-latin", target_lang='uig-script_latin'),
|
38 |
+
"ctc_model": True
|
39 |
+
},
|
40 |
}
|
41 |
|
42 |
def transcribe(audio_data, model_id) -> str:
|
|
|
76 |
audio_input = resampler(audio_input)
|
77 |
|
78 |
# Preprocess the audio input
|
79 |
+
inputs = processor(audio_input.squeeze(), sampling_rate=target_sr, return_tensors="pt")
|
80 |
|
81 |
# Move model to GPU if available
|
82 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|