Spaces:
Sleeping
Sleeping
ashutosh commited on
Commit ·
8ada825
1
Parent(s): 924dbb1
text-summarization-app
Browse files- app.py +24 -0
- env/conda-meta/history +3 -0
- requirements.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
get_completion = pipeline("summarization", model="shleifer/distilbart-cnn-12-6")
|
| 6 |
+
|
| 7 |
+
def summarize(input):
|
| 8 |
+
output = get_completion(input)
|
| 9 |
+
return output[0]['summary_text']
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def summarize(input):
|
| 14 |
+
output = get_completion(input)
|
| 15 |
+
return output[0]['summary_text']
|
| 16 |
+
|
| 17 |
+
gr.close_all()
|
| 18 |
+
demo = gr.Interface(fn=summarize,
|
| 19 |
+
inputs=[gr.Textbox(label="Text to summarize", lines=6)],
|
| 20 |
+
outputs=[gr.Textbox(label="Result", lines=3)],
|
| 21 |
+
title="Text summarization with distilbart-cnn",
|
| 22 |
+
description="Summarize any text using the `shleifer/distilbart-cnn-12-6` model under the hood!"
|
| 23 |
+
)
|
| 24 |
+
demo.launch()
|
env/conda-meta/history
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
==> 2023-08-24 20:08:25 <==
|
| 2 |
+
# cmd: /home/ashutosh/anaconda3/bin/conda create --prefix ./env
|
| 3 |
+
# conda version: 23.7.2
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
torch
|
| 3 |
+
gradio
|