Spaces:
Sleeping
Sleeping
Dmytro Vodianytskyi
commited on
Commit
·
2b29e41
1
Parent(s):
82c52c7
minor uptdates
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ MODEL = MT5ForConditionalGeneration.from_pretrained("werent4/mt5TranslatorLT")
|
|
8 |
MODEL.to(DEVICE)
|
9 |
|
10 |
def translate(text, mode, max_length, num_beams):
|
11 |
-
text = f"translate English to Lithuanian: {text}"
|
12 |
encoded_input = TOKENIZER(text, return_tensors="pt", padding=True, truncation=True, max_length=max_length).to(DEVICE)
|
13 |
with torch.no_grad():
|
14 |
output_tokens = MODEL.generate(
|
@@ -30,7 +30,7 @@ with gr.Blocks() as interface:
|
|
30 |
with gr.Row():
|
31 |
input_text = gr.Textbox(label="Text input", placeholder="Enter your text here")
|
32 |
with gr.Column():
|
33 |
-
mode = gr.Dropdown(label="Mode", choices=["
|
34 |
translate_button = gr.Button("Translate")
|
35 |
output_text = gr.Textbox(label="Translated text")
|
36 |
with gr.Accordion("How to run the model locally:", open=False):
|
|
|
8 |
MODEL.to(DEVICE)
|
9 |
|
10 |
def translate(text, mode, max_length, num_beams):
|
11 |
+
text = f"translate English to Lithuanian: {text}"
|
12 |
encoded_input = TOKENIZER(text, return_tensors="pt", padding=True, truncation=True, max_length=max_length).to(DEVICE)
|
13 |
with torch.no_grad():
|
14 |
output_tokens = MODEL.generate(
|
|
|
30 |
with gr.Row():
|
31 |
input_text = gr.Textbox(label="Text input", placeholder="Enter your text here")
|
32 |
with gr.Column():
|
33 |
+
mode = gr.Dropdown(label="Mode", choices=["Currenly wroking only in en-lt", "Currenly wroking only in en-lt"])
|
34 |
translate_button = gr.Button("Translate")
|
35 |
output_text = gr.Textbox(label="Translated text")
|
36 |
with gr.Accordion("How to run the model locally:", open=False):
|