Spaces:
Sleeping
Sleeping
File size: 664 Bytes
d65d045 f3738c6 d65d045 da35fc5 f3738c6 d65d045 f3738c6 da35fc5 f3738c6 79f6639 f3738c6 da35fc5 79f6639 da35fc5 f3738c6 da35fc5 79f6639 da35fc5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 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()
|