fvwjtemlfmyztvgzla commited on
Commit
44f9786
·
1 Parent(s): cfba493

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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 = "en"
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()