Spaces:
Sleeping
Sleeping
shubham5027
commited on
Commit
·
2b64fb4
1
Parent(s):
7b404f5
Upload 2 files
Browse files- app.py +26 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
5 |
+
|
6 |
+
def main():
|
7 |
+
st.title("Text Summarizer App")
|
8 |
+
|
9 |
+
|
10 |
+
input_text = st.text_area("Enter the text you want to summarize:")
|
11 |
+
|
12 |
+
# Sidebar
|
13 |
+
min_length = st.sidebar.slider("Minimum Summary Length", 10, 200, 50)
|
14 |
+
max_length = st.sidebar.slider("Maximum Summary Length", 50, 500, 100)
|
15 |
+
|
16 |
+
if st.button("Generate Summary"):
|
17 |
+
if input_text:
|
18 |
+
# Generate summary
|
19 |
+
summary = summarizer(input_text, max_length=max_length, min_length=min_length, do_sample=False)
|
20 |
+
st.subheader("Generated Summary:")
|
21 |
+
st.write(summary[0]["summary_text"])
|
22 |
+
else:
|
23 |
+
st.warning("Please enter some text to summarize.")
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
main()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
streamlit==1.20.0
|
2 |
+
transformers==4.36.2
|