Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files- README.md +6 -6
- app.py +25 -0
- requirements.txt +3 -0
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title: Text
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: streamlit
|
| 7 |
-
sdk_version: 1.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Bart Text Summarization
|
| 3 |
+
emoji: ๐
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: streamlit
|
| 7 |
+
sdk_version: 1.28.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference# text-summarization
|
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Instantiating summarization pipeline with the bart-finetuned-samsum model
|
| 5 |
+
summarizer = pipeline(task="summarization", model="luisotorres/bart-finetuned-samsum")
|
| 6 |
+
|
| 7 |
+
# Title
|
| 8 |
+
st.title("๐ Text Summarization with BART")
|
| 9 |
+
|
| 10 |
+
# Creating a sidebar for input
|
| 11 |
+
with st.sidebar:
|
| 12 |
+
st.header("Input")
|
| 13 |
+
input_text = st.text_area("Enter a text or dialogue for summarization.")
|
| 14 |
+
|
| 15 |
+
# Creating a button to start the summarization
|
| 16 |
+
if st.button("Summarize"):
|
| 17 |
+
# If the input box isn't empty, process the input and generate a summary
|
| 18 |
+
if input_text:
|
| 19 |
+
summary = summarizer(input_text, max_length=1024, min_length=0, do_sample=False)
|
| 20 |
+
st.subheader("Original Text")
|
| 21 |
+
st.write(input_text)
|
| 22 |
+
st.subheader("Summary")
|
| 23 |
+
st.write(summary[0]["summary_text"])
|
| 24 |
+
else:
|
| 25 |
+
st.warning("Enter a text or dialogue for summarization.")
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
torch
|
| 3 |
+
streamlit
|