Spaces:
Runtime error
Runtime error
Update app.py
Browse filesdefaulting English to Arabic
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-
|
| 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="
|
| 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="
|
| 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("")
|