davanstrien HF staff commited on
Commit
49900d0
1 Parent(s): 73dc922

Remove low quality languages from target languages

Browse files

Remove Ligurian (lij_Latn), Lombard (lmo_Latn) and Sicilian (scn_Latn) as target languages from the interface

Files changed (1) hide show
  1. app.py +5 -2
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=flores_codes)
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():