Spaces:
Sleeping
Sleeping
nyarkssss
commited on
Commit
·
9b2d2d1
1
Parent(s):
ab00c83
initial commit
Browse files- flores200_codes.py +4 -3
- nllb.py +2 -1
flores200_codes.py
CHANGED
@@ -4,9 +4,10 @@ English eng_Latn
|
|
4 |
Twi twi_Latn
|
5 |
'''
|
6 |
|
7 |
-
codes_as_string = codes_as_string.split('\n')
|
8 |
|
9 |
flores_codes = {}
|
10 |
for code in codes_as_string:
|
11 |
-
|
12 |
-
|
|
|
|
4 |
Twi twi_Latn
|
5 |
'''
|
6 |
|
7 |
+
codes_as_string = codes_as_string.strip().split('\n')
|
8 |
|
9 |
flores_codes = {}
|
10 |
for code in codes_as_string:
|
11 |
+
if code.strip(): # Skip empty lines
|
12 |
+
lang, lang_code = code.split('\t')
|
13 |
+
flores_codes[lang] = lang_code
|
nllb.py
CHANGED
@@ -2,7 +2,8 @@ import os
|
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
3 |
from flores200_codes import flores_codes
|
4 |
|
5 |
-
|
|
|
6 |
model_dict = {}
|
7 |
|
8 |
|
|
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
3 |
from flores200_codes import flores_codes
|
4 |
|
5 |
+
# Use HF_TOKEN from environment or fall back to True (for public models)
|
6 |
+
hf_token = auth_token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGINGFACE_HUB_TOKEN") or True
|
7 |
model_dict = {}
|
8 |
|
9 |
|