SeyedAli commited on
Commit
126e823
1 Parent(s): 98b82a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -6,13 +6,12 @@ tokenizer = MT5Tokenizer.from_pretrained(model_name)
6
  model = MT5ForConditionalGeneration.from_pretrained(model_name)
7
 
8
  text_input = gr.TextArea(label="جمله فارسی",text_align="right",rtl=True,type="text")
9
- text_output = gr.TextArea(label="ترجمه انگلیسی",text_align="right",rtl=True,type="text")
10
 
11
  def Translate(text, **generator_args):
12
- input_ids = tokenizer.encode(input_string, return_tensors="pt")
13
  res = model.generate(input_ids, **generator_args)
14
  output = tokenizer.batch_decode(res, skip_special_tokens=True)
15
- print(output)
16
  return output
17
 
18
  iface = gr.Interface(fn=Translate, inputs=text_input, outputs=text_output)
 
6
  model = MT5ForConditionalGeneration.from_pretrained(model_name)
7
 
8
  text_input = gr.TextArea(label="جمله فارسی",text_align="right",rtl=True,type="text")
9
+ text_output = gr.TextArea(label="ترجمه انگلیسی",text_align="left",rtl=True,type="text")
10
 
11
  def Translate(text, **generator_args):
12
+ input_ids = tokenizer.encode(text, return_tensors="pt")
13
  res = model.generate(input_ids, **generator_args)
14
  output = tokenizer.batch_decode(res, skip_special_tokens=True)
 
15
  return output
16
 
17
  iface = gr.Interface(fn=Translate, inputs=text_input, outputs=text_output)