krishgokul92 commited on
Commit
f0aca1e
·
verified ·
1 Parent(s): 4f89921

Update app.py

Browse files

defaulting English to Arabic

Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -60,7 +60,7 @@ def translate(input_text, source, target):
60
  target_lang_dict, _ = get_target_languages(source)
61
  try:
62
  target = target_lang_dict[target]
63
- model = f"Helsinki-NLP/opus-mt-{source}-{target}"
64
  pipe = pipeline("translation", model=model)
65
  translation = pipe(input_text)
66
  return translation[0]['translation_text'], ""
@@ -84,12 +84,12 @@ with gr.Blocks() as demo:
84
  with gr.Row():
85
  with gr.Column():
86
  source_language_dropdown = gr.Dropdown(choices=source_languages,
87
- value="Auto Detect",
88
  label="Source Language")
89
  input_textbox = gr.Textbox(lines=5, placeholder="Enter text to translate", label="Input Text")
90
  with gr.Column():
91
  target_language_dropdown = gr.Dropdown(choices=["English", "French", "Spanish"],
92
- value="English",
93
  label="Target Language")
94
  translated_textbox = gr.Textbox(lines=5, placeholder="", label="Translated Text")
95
  info_label = gr.HTML("")
 
60
  target_lang_dict, _ = get_target_languages(source)
61
  try:
62
  target = target_lang_dict[target]
63
+ model = f"Helsinki-NLP/opus-mt-en-ar"
64
  pipe = pipeline("translation", model=model)
65
  translation = pipe(input_text)
66
  return translation[0]['translation_text'], ""
 
84
  with gr.Row():
85
  with gr.Column():
86
  source_language_dropdown = gr.Dropdown(choices=source_languages,
87
+ value="English",
88
  label="Source Language")
89
  input_textbox = gr.Textbox(lines=5, placeholder="Enter text to translate", label="Input Text")
90
  with gr.Column():
91
  target_language_dropdown = gr.Dropdown(choices=["English", "French", "Spanish"],
92
+ value="Arabic",
93
  label="Target Language")
94
  translated_textbox = gr.Textbox(lines=5, placeholder="", label="Translated Text")
95
  info_label = gr.HTML("")