paraphraser-api / app.py
prowriting's picture
Rename project to "Smooth Paraphraser"
f3738c6 verified
raw
history blame
633 Bytes
import gradio as gr
from transformers import pipeline
# Load paraphrasing pipeline
paraphraser = pipeline("text2text-generation", model="Vamsi/T5_Paraphrase_Paws")
def paraphrase(text):
result = paraphraser(text, max_length=100, num_return_sequences=1)
return result[0]['generated_text']
# Gradio interface
demo = gr.Interface(
fn=paraphrase,
inputs=gr.Textbox(lines=4, placeholder="Enter text to paraphrase..."),
outputs="text",
title="Smooth Paraphraser",
description="A simple app to smoothly paraphrase text using a pretrained T5 transformer model."
)
if __name__ == "__main__":
demo.launch()