Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load the model
|
| 5 |
+
pipe = pipeline("summarization", model="prithivMLmods/t5-Flan-Prompt-Enhance")
|
| 6 |
+
|
| 7 |
+
def summarize_text(text):
|
| 8 |
+
result = pipe(text, max_length=150, min_length=30, do_sample=False)
|
| 9 |
+
return result[0]['summary_text']
|
| 10 |
+
|
| 11 |
+
demo = gr.Interface(fn=summarize_text, inputs="text", outputs="text")
|
| 12 |
+
|
| 13 |
+
demo.launch()
|