Regino commited on
Commit
590870f
·
1 Parent(s): d0b940d
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Force PyTorch backend
5
+ summarizer = pipeline("summarization", model="facebook/bart-large-cnn", framework="pt")
6
+
7
+ st.title("Text Summarization App")
8
+
9
+ # Input text
10
+ text = st.text_area("Enter your text:", "")
11
+
12
+ if st.button("Summarize"):
13
+ if text:
14
+ summary = summarizer(text, max_length=50, min_length=10, do_sample=False)
15
+ st.subheader("Summary:")
16
+ st.write(summary[0]["summary_text"])
17
+ else:
18
+ st.warning("Please enter some text.")