yash19811441 commited on
Commit
cda54eb
·
verified ·
1 Parent(s): 6ae4e83

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline("text2text-generation", model="mrm8488/t5-base-finetuned-common_gen")
5
+
6
+ def enhance(text):
7
+ prompt = f"paraphrase: {text}"
8
+ result = pipe(prompt, max_length=128, num_return_sequences=1, do_sample=True)[0]['generated_text']
9
+ return result
10
+
11
+ gr.Interface(fn=enhance, inputs="text", outputs="text", title="Text Enhancer").launch()