Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
74a629f
1
Parent(s):
73dc922
Remove low quality languages from target languages (#5)
Browse files- Remove low quality languages from target languages (49900d0cf969370e83745811c86ce1d8ed17b1db)
app.py
CHANGED
@@ -8,12 +8,15 @@ import nltk
|
|
8 |
|
9 |
nltk.download("punkt")
|
10 |
|
|
|
|
|
|
|
11 |
device = "cpu" if platform.system() == "Darwin" else "cuda"
|
12 |
MODEL_NAME = "facebook/nllb-200-3.3B"
|
13 |
|
14 |
code_mapping = dict(sorted(code_mapping.items(), key=lambda item: item[1]))
|
15 |
flores_codes = list(code_mapping.keys())
|
16 |
-
|
17 |
|
18 |
def load_model():
|
19 |
model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME).to(device)
|
@@ -77,7 +80,7 @@ with gr.Blocks() as demo:
|
|
77 |
gr.Markdown(description)
|
78 |
with gr.Row():
|
79 |
src_lang = gr.Dropdown(label="Source Language", choices=flores_codes)
|
80 |
-
target_lang = gr.Dropdown(label="Target Language", choices=
|
81 |
with gr.Row():
|
82 |
input_text = gr.Textbox(label="Input Text", lines=6)
|
83 |
with gr.Row():
|
|
|
8 |
|
9 |
nltk.download("punkt")
|
10 |
|
11 |
+
REMOVED_TARGET_LANGUAGES = {"Ligurian", "Lombard", "Sicilian"}
|
12 |
+
|
13 |
+
|
14 |
device = "cpu" if platform.system() == "Darwin" else "cuda"
|
15 |
MODEL_NAME = "facebook/nllb-200-3.3B"
|
16 |
|
17 |
code_mapping = dict(sorted(code_mapping.items(), key=lambda item: item[1]))
|
18 |
flores_codes = list(code_mapping.keys())
|
19 |
+
target_languages = [language for language in flores_codes if not language in REMOVED_TARGET_LANGUAGES]
|
20 |
|
21 |
def load_model():
|
22 |
model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME).to(device)
|
|
|
80 |
gr.Markdown(description)
|
81 |
with gr.Row():
|
82 |
src_lang = gr.Dropdown(label="Source Language", choices=flores_codes)
|
83 |
+
target_lang = gr.Dropdown(label="Target Language", choices=target_languages)
|
84 |
with gr.Row():
|
85 |
input_text = gr.Textbox(label="Input Text", lines=6)
|
86 |
with gr.Row():
|