Spaces:
Sleeping
Sleeping
Dmytro Vodianytskyi
commited on
Commit
·
504e122
1
Parent(s):
ec49d0d
space updated
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ def translate(text, device, max_length, num_beams, translation_way = "en-lt"):
|
|
14 |
}
|
15 |
if translation_way not in translations_ways:
|
16 |
raise ValueError(f"Invalid translation way. Supported ways: {list(translations_ways.keys())}")
|
17 |
-
|
18 |
encoded_input = TOKENIZER(input_text, return_tensors="pt", padding=True, truncation=True, max_length=128).to(device)
|
19 |
with torch.no_grad():
|
20 |
output_tokens = MODEL.generate(
|
|
|
14 |
}
|
15 |
if translation_way not in translations_ways:
|
16 |
raise ValueError(f"Invalid translation way. Supported ways: {list(translations_ways.keys())}")
|
17 |
+
input_text = f"{translations_ways[translation_way]} {text}"
|
18 |
encoded_input = TOKENIZER(input_text, return_tensors="pt", padding=True, truncation=True, max_length=128).to(device)
|
19 |
with torch.no_grad():
|
20 |
output_tokens = MODEL.generate(
|