SeyedAli's picture
Update app.py
f27a4ff
raw
history blame contribute delete
583 Bytes
import gradio as gr
import torch
from transformers import T5ForConditionalGeneration,AutoTokenizer,pipeline
tokenizer = AutoTokenizer.from_pretrained('SeyedAli/Persian-Text-paraphraser-mT5-V1',model_max_length=100, add_special_tokens = True)
model = T5ForConditionalGeneration.from_pretrained('SeyedAli/Persian-Text-paraphraser-mT5-V1')
def Paraphrase(text):
pipline = pipeline(task='text2text-generation', model=model, tokenizer=tokenizer)
output=pipline(text)
return output
iface = gr.Interface(fn=Paraphrase, inputs="text", outputs="text")
iface.launch(share=False)