samzirbo commited on
Commit
d74e010
1 Parent(s): 954d446

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -2,10 +2,10 @@ import gradio as gr
2
  from transformers import pipeline
3
 
4
  available_models = {
5
- "mt5.baseline": pipeline("text2text-generation", model="samzirbo/mt5.baseline"),
6
- "mt5.genered": pipeline("text2text-generation", model="samzirbo/mt5.gendered"),
7
- "mt5.balanced": pipeline("text2text-generation", model="samzirbo/mt5.balanced"),
8
- "mt5.gendered_balanced": pipeline("text2text-generation", model="samzirbo/mt5.gendered_balanced")
9
  }
10
 
11
  def translate_text(model_name, lang_dir, gender, input_text):
@@ -21,14 +21,13 @@ def translate_text(model_name, lang_dir, gender, input_text):
21
  return output_text[0]['generated_text']
22
 
23
 
24
- model_dropdown = gr.Dropdown(choices=list(available_models.keys()), label="Select Model", value="mt5.baseline")
25
  lang_dropdown = gr.Dropdown(choices=["English -> Spanish", "Spanish -> English"], label="Language Direction", value="English -> Spanish")
26
  gender_dropdown = gr.Dropdown(choices=["female", "male"], label="Select Gender", value=None)
27
 
28
  iface = gr.Interface(fn=translate_text,
29
  inputs=[model_dropdown, lang_dropdown, gender_dropdown, "text"],
30
  outputs="text",
31
- title="Translation Interface",
32
- description="Select a model, language direction, and input text to translate.")
33
 
34
  iface.launch()
 
2
  from transformers import pipeline
3
 
4
  available_models = {
5
+ "Baseline": pipeline("text2text-generation", model="samzirbo/mt5.baseline"),
6
+ "Genered": pipeline("text2text-generation", model="samzirbo/mt5.gendered"),
7
+ "Balanced": pipeline("text2text-generation", model="samzirbo/mt5.balanced"),
8
+ "Gendered and Balanced": pipeline("text2text-generation", model="samzirbo/mt5.gendered_balanced")
9
  }
10
 
11
  def translate_text(model_name, lang_dir, gender, input_text):
 
21
  return output_text[0]['generated_text']
22
 
23
 
24
+ model_dropdown = gr.Dropdown(choices=list(available_models.keys()), label="Select Model", value="Baseline")
25
  lang_dropdown = gr.Dropdown(choices=["English -> Spanish", "Spanish -> English"], label="Language Direction", value="English -> Spanish")
26
  gender_dropdown = gr.Dropdown(choices=["female", "male"], label="Select Gender", value=None)
27
 
28
  iface = gr.Interface(fn=translate_text,
29
  inputs=[model_dropdown, lang_dropdown, gender_dropdown, "text"],
30
  outputs="text",
31
+ title="Translation Interface")
 
32
 
33
  iface.launch()