Spaces:
Running
Running
import gradio as gr | |
from transformers import pipeline | |
# Load model | |
paraphraser = pipeline("text2text-generation", model="Vamsi/T5_Paraphrase_Paws") | |
def paraphrase(text): | |
if not text.strip(): | |
return "Please enter some text." | |
result = paraphraser(text, max_length=128, num_return_sequences=1, do_sample=False) | |
return result[0]['generated_text'] | |
# Gradio interface | |
iface = gr.Interface( | |
fn=paraphrase, | |
inputs=gr.Textbox(lines=4, placeholder="Enter text here..."), | |
outputs="text", | |
title="Smooth Paraphraser", | |
description="Rewrite sentences smoothly while preserving meaning." | |
) | |
if __name__ == "__main__": | |
iface.launch() | |