Spaces:
Runtime error
Runtime error
Dmytro Vodianytskyi
commited on
Commit
·
2b46acc
1
Parent(s):
5cfd806
space updated
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ TOKENIZER = T5Tokenizer.from_pretrained('werent4/mt5TranslatorLT')
|
|
| 7 |
MODEL = MT5ForConditionalGeneration.from_pretrained("werent4/mt5TranslatorLT")
|
| 8 |
MODEL.to(DEVICE)
|
| 9 |
|
| 10 |
-
def translate(text, model,
|
| 11 |
translations_ways = {
|
| 12 |
"en-lt": "<EN2LT>",
|
| 13 |
"lt-en": "<LT2EN>"
|
|
@@ -36,7 +36,7 @@ with gr.Blocks() as interface:
|
|
| 36 |
with gr.Row():
|
| 37 |
input_text = gr.Textbox(label="Text input", placeholder="Enter your text here")
|
| 38 |
with gr.Column():
|
| 39 |
-
|
| 40 |
translate_button = gr.Button("Translate")
|
| 41 |
output_text = gr.Textbox(label="Translated text")
|
| 42 |
with gr.Accordion("How to run the model locally:", open=False):
|
|
|
|
| 7 |
MODEL = MT5ForConditionalGeneration.from_pretrained("werent4/mt5TranslatorLT")
|
| 8 |
MODEL.to(DEVICE)
|
| 9 |
|
| 10 |
+
def translate(text, model,device, translation_way = "en-lt"):
|
| 11 |
translations_ways = {
|
| 12 |
"en-lt": "<EN2LT>",
|
| 13 |
"lt-en": "<LT2EN>"
|
|
|
|
| 36 |
with gr.Row():
|
| 37 |
input_text = gr.Textbox(label="Text input", placeholder="Enter your text here")
|
| 38 |
with gr.Column():
|
| 39 |
+
translation_way = gr.Dropdown(label="Mode", choices=["en-lt", "lt-en"])
|
| 40 |
translate_button = gr.Button("Translate")
|
| 41 |
output_text = gr.Textbox(label="Translated text")
|
| 42 |
with gr.Accordion("How to run the model locally:", open=False):
|