nimesh-p commited on
Commit
47c4bc7
1 Parent(s): 5f149de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -17
app.py CHANGED
@@ -1,17 +1,25 @@
1
- certifi
2
- charset-normalizer
3
- filelock
4
- fsspec
5
- huggingface-hub
6
- idna
7
- numpy
8
- packaging
9
- PyYAML
10
- regex
11
- requests
12
- safetensors
13
- tokenizers
14
- tqdm
15
- transformers
16
- typing_extensions
17
- urllib3
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import AutoTokenizer, pipeline
3
+
4
+ st.title("Text Summarization App")
5
+
6
+ # Initialize the summarizer
7
+ summarizer = pipeline("summarization", model="pszemraj/led-large-book-summary")
8
+ tokenizer = AutoTokenizer.from_pretrained("pszemraj/led-large-book-summary")
9
+
10
+ # Input text area
11
+ article = st.text_area("Enter Text to Summarize:")
12
+
13
+ # Summarization button
14
+ if st.button("Summarize"):
15
+ if article:
16
+ # Perform summarization
17
+ data = summarizer(article, max_length=200, min_length=180, do_sample=False)
18
+ summary = data[0]["summary_text"]
19
+
20
+ # Display the summary
21
+ st.subheader("Summary:")
22
+ st.write(summary)
23
+ else:
24
+ st.warning("Please enter some text to summarize.")
25
+