hqadzenhancer / app.py
yash19811441's picture
Create app.py
cda54eb verified
raw
history blame contribute delete
405 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("text2text-generation", model="mrm8488/t5-base-finetuned-common_gen")
def enhance(text):
prompt = f"paraphrase: {text}"
result = pipe(prompt, max_length=128, num_return_sequences=1, do_sample=True)[0]['generated_text']
return result
gr.Interface(fn=enhance, inputs="text", outputs="text", title="Text Enhancer").launch()