Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ tokenizer = AutoTokenizer.from_pretrained("ieuniversity/sciencebrief_translation
|
|
5 |
model = AutoModelForSeq2SeqLM.from_pretrained("ieuniversity/sciencebrief_translation")
|
6 |
|
7 |
def translate(text):
|
8 |
-
input_ids = tokenizer
|
9 |
output_ids = model.generate(input_ids)
|
10 |
output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
11 |
return output_text
|
|
|
5 |
model = AutoModelForSeq2SeqLM.from_pretrained("ieuniversity/sciencebrief_translation")
|
6 |
|
7 |
def translate(text):
|
8 |
+
input_ids = tokenizer(text, return_tensors="pt", truncation=True)['input_ids']
|
9 |
output_ids = model.generate(input_ids)
|
10 |
output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
11 |
return output_text
|