Spaces:
Sleeping
Sleeping
Add application file
Browse files- README.md +2 -2
- app.py +18 -0
- requirements.txt +2 -0
README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
---
|
| 2 |
title: Text Summarizer
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 5.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
|
|
|
| 1 |
---
|
| 2 |
title: Text Summarizer
|
| 3 |
+
emoji: 📃
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.1.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
pipeline = pipeline(task="summarization", model="dross20/summarization_model")
|
| 5 |
+
|
| 6 |
+
def predict(input_text):
|
| 7 |
+
predictions = pipeline(input_text)
|
| 8 |
+
return predictions[0]['summary_text']
|
| 9 |
+
|
| 10 |
+
gradio_app = gr.Interface(
|
| 11 |
+
predict,
|
| 12 |
+
inputs = gr.Textbox(label="Enter text to be summarized"),
|
| 13 |
+
outputs = gr.Textbox(label="Result"),
|
| 14 |
+
title="Text Summarizer"
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
gradio_app.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
torch
|