Spaces:
Runtime error
Runtime error
File size: 935 Bytes
591e728 36f8039 90f3db5 448421a 90f3db5 36f8039 90f3db5 36f8039 b8dd96a 36f8039 00cab09 b8dd96a 90f3db5 36f8039 90f3db5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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 ) |