TiberiuCristianLeon commited on
Commit
c6657b6
·
verified ·
1 Parent(s): cfc1658

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import spaces
3
  from transformers import T5Tokenizer, T5ForConditionalGeneration, AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
4
 
5
- langs = {"English": ("en", "eng_Latn"), "Romanian": ("ro", "ron_Latn"), "German": ("de", "deu_Latn"), "French": ("fr", "fra_Latn"), "Spanish": ("es", "spa_Latn"), "Italian": ("it", "ita_Latn")}
6
  options = list(langs.keys())
7
  models = ["Helsinki-NLP", "t5-base", "t5-small", "t5-large", "facebook/nllb-200-distilled-1.3B", "facebook/nllb-200-distilled-600M"]
8
 
@@ -55,8 +55,8 @@ def create_interface():
55
  input_text = gr.Textbox(label="Enter text to translate:", placeholder="Type your text here...")
56
 
57
  with gr.Row():
58
- sselected_language = gr.Dropdown(choices=options, label="Source language")
59
- tselected_language = gr.Dropdown(choices=options, label="Target language")
60
  swap_button = gr.Button("Swap Languages")
61
  swap_button.click(fn=swap_languages, inputs=[sselected_language, tselected_language], outputs=[sselected_language, tselected_language])
62
 
 
2
  import spaces
3
  from transformers import T5Tokenizer, T5ForConditionalGeneration, AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
4
 
5
+ langs = {"German": ("de", "deu_Latn"), "Romanian": ("ro", "ron_Latn"), "English": ("en", "eng_Latn"), "French": ("fr", "fra_Latn"), "Spanish": ("es", "spa_Latn"), "Italian": ("it", "ita_Latn")}
6
  options = list(langs.keys())
7
  models = ["Helsinki-NLP", "t5-base", "t5-small", "t5-large", "facebook/nllb-200-distilled-1.3B", "facebook/nllb-200-distilled-600M"]
8
 
 
55
  input_text = gr.Textbox(label="Enter text to translate:", placeholder="Type your text here...")
56
 
57
  with gr.Row():
58
+ sselected_language = gr.Dropdown(choices=options, value = options[0], label="Source language" interactive=True)
59
+ tselected_language = gr.Dropdown(choices=options, value = options[1], label="Target language", interactive=True)
60
  swap_button = gr.Button("Swap Languages")
61
  swap_button.click(fn=swap_languages, inputs=[sselected_language, tselected_language], outputs=[sselected_language, tselected_language])
62