ANYANTUDRE commited on
Commit
d42359a
·
1 Parent(s): 2abf83e

fixed LANG_TO_ID error

Browse files
Files changed (1) hide show
  1. goai_helpers/goai_stt2.py +17 -1
goai_helpers/goai_stt2.py CHANGED
@@ -3,7 +3,23 @@ import spaces
3
  from transformers import pipeline
4
 
5
  DEVICE = 0 if torch.cuda.is_available() else "cpu"
6
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  @spaces.GPU
9
  def transcribe(
 
3
  from transformers import pipeline
4
 
5
  DEVICE = 0 if torch.cuda.is_available() else "cpu"
6
+ # Whisper's full language ID mapping
7
+ LANG_TO_ID = {
8
+ "en": 0, "zh": 1, "de": 2, "es": 3, "ru": 4, "ko": 5, "fr": 6, "ja": 7,
9
+ "pt": 8, "tr": 9, "pl": 10, "ca": 11, "nl": 12, "ar": 13, "sv": 14,
10
+ "it": 15, "id": 16, "hi": 17, "fi": 18, "vi": 19, "he": 20, "uk": 21,
11
+ "el": 22, "ms": 23, "cs": 24, "ro": 25, "da": 26, "hu": 27, "ta": 28,
12
+ "no": 29, "th": 30, "ur": 31, "hr": 32, "bg": 33, "lt": 34, "la": 35,
13
+ "mi": 36, "ml": 37, "cy": 38, "sk": 39, "te": 40, "fa": 41, "lv": 42,
14
+ "bn": 43, "sr": 44, "az": 45, "sl": 46, "kn": 47, "et": 48, "mk": 49,
15
+ "br": 50, "eu": 51, "is": 52, "hy": 53, "ne": 54, "mn": 55, "bs": 56,
16
+ "kk": 57, "sq": 58, "sw": 59, "gl": 60, "mr": 61, "pa": 62, "si": 63,
17
+ "km": 64, "sn": 65, "yo": 66, "so": 67, "af": 68, "oc": 69, "ka": 70,
18
+ "be": 71, "tg": 72, "sd": 73, "gu": 74, "am": 75, "yi": 76, "lo": 77,
19
+ "uz": 78, "fo": 79, "ht": 80, "ps": 81, "tk": 82, "nn": 83, "mt": 84,
20
+ "sa": 85, "lb": 86, "my": 87, "bo": 88, "tl": 89, "mg": 90, "as": 91,
21
+ "tt": 92, "haw": 93, "ln": 94, "ha": 95, "ba": 96, "jw": 97, "su": 98
22
+ }
23
 
24
  @spaces.GPU
25
  def transcribe(