Spaces:
Runtime error
Runtime error
with input
Browse files
app.py
CHANGED
@@ -1,29 +1,25 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
Amanda: Lemme check
|
9 |
-
Amanda: Sorry, can't find it.
|
10 |
-
Amanda: Ask Larry
|
11 |
-
Amanda: He called her last time we were at the park together
|
12 |
-
Hannah: I don't know him well
|
13 |
-
Amanda: Don't be shy, he's very nice
|
14 |
-
Hannah: If you say so..
|
15 |
-
Hannah: I'd rather you texted him
|
16 |
-
Amanda: Just text him 🙂
|
17 |
-
Hannah: Urgh.. Alright
|
18 |
-
Hannah: Bye
|
19 |
-
Amanda: Bye bye
|
20 |
-
"""
|
21 |
|
22 |
-
|
23 |
-
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Set up the summarization pipeline
|
5 |
+
summarizer = pipeline(task="summarization", model="lidiya/bart-large-xsum-samsum")
|
6 |
|
7 |
+
# Title for the Streamlit app
|
8 |
+
st.title("Huggingface Summarizer App")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
+
# Create a sidebar for input
|
11 |
+
with st.sidebar:
|
12 |
+
st.header("Input")
|
13 |
+
input_text = st.text_area("Enter your text to be summarized:")
|
14 |
|
15 |
+
# Create 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=256, min_length=0, do_sample=False)
|
20 |
+
st.subheader("Summary")
|
21 |
+
st.write(summary[0]["summary_text"])
|
22 |
+
else:
|
23 |
+
st.warning("Please enter some text to summarize.")
|
24 |
+
else:
|
25 |
+
st.subheader("Summary will appear here...")
|