Spaces:
Runtime error
Runtime error
fvwjtemlfmyztvgzla
commited on
Commit
·
44f9786
1
Parent(s):
cfba493
Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,11 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
8 |
tokenizer = AutoTokenizer.from_pretrained("alirezamsh/small100")
|
9 |
model = AutoModelForSeq2SeqLM.from_pretrained("alirezamsh/small100")
|
10 |
|
11 |
-
def fn(text):
|
12 |
-
tokenizer.tgt_lang =
|
13 |
encoded_zh = tokenizer(text, return_tensors="pt")
|
14 |
generated_tokens = model.generate(**encoded_zh)
|
15 |
return tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
|
16 |
|
17 |
-
demo = gr.Interface(fn=fn, inputs="text", outputs="text")
|
18 |
demo.launch()
|
|
|
8 |
tokenizer = AutoTokenizer.from_pretrained("alirezamsh/small100")
|
9 |
model = AutoModelForSeq2SeqLM.from_pretrained("alirezamsh/small100")
|
10 |
|
11 |
+
def fn(text, lang):
|
12 |
+
tokenizer.tgt_lang = lang
|
13 |
encoded_zh = tokenizer(text, return_tensors="pt")
|
14 |
generated_tokens = model.generate(**encoded_zh)
|
15 |
return tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
|
16 |
|
17 |
+
demo = gr.Interface(fn=fn, inputs="text", outputs=["text", "text"])
|
18 |
demo.launch()
|