Update app.py (#1)
Browse files- Update app.py (7c6189a2e98a0e1c45f5d473c6e81c32da027b4f)
Co-authored-by: mes <[email protected]>
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
|