Spaces:
Runtime error
Runtime error
Create app.py
Browse files
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()
|