File size: 928 Bytes
591e728
36f8039
90f3db5
448421a
 
90f3db5
36f8039
90f3db5
36f8039
b8dd96a
36f8039
b704017
00cab09
01b17a2
90f3db5
bb46bbf
90f3db5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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 len(para_phrases) > 1 else '' , para_phrases[2][0] if len(para_phrases) > 2 else ''

examples = [["Uploading a video to YouTube can help exposure for your business.", "45"], ["Niagara Falls is viewed by thousands of tourists every year.", "30"]]

demo = gr.Interface(fn=paraphrase_text, inputs=gr.Textbox(lines=3, placeholder="Enter sample text here", label="Original text"), outputs=[gr.Textbox(label="Paraphrasing 1"), gr.Textbox(label="Paraphrasing 2"), gr.Textbox(label="Paraphrasing 3")], examples=examples)
demo.launch( debug = True )