import gradio as gr from parrot import Parrot import torch import warnings warnings.filterwarnings("ignore") parrot = Parrot(model_tag="prithivida/parrot_paraphraser_on_T5", use_gpu=False) def paraphrase_text(input_text): para_phrases = parrot.augment(input_phrase=input_text, max_return_phrases = 3) return para_phrases[0][0], para_phrases[1][0] if para_phrases[1][0] else '' , para_phrases[2][0] if para_phrases[2][0] else '' examples = [["Begin your professional career by learning data science skills with Data Science Dojo, a globally recognized e-learning platform where we teach students how to learn data science, data analytics, machine learning, and more.", "45"], ["Hello, I am a paraphrasing tool. How can I help you?", "30"]] demo = gr.Interface(fn=paraphrase_text, inputs="text", outputs=["text", "text", "text"], title="Paraphrase", examples=examples) demo.launch( debug = True )