Commit
·
57aa4ae
1
Parent(s):
0e1b777
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytextrank
|
| 2 |
+
import spacy
|
| 3 |
+
import streamlit as st
|
| 4 |
+
nlp = spacy.load("en_core_web_sm")
|
| 5 |
+
nlp.add_pipe("textrank")
|
| 6 |
+
input= st.text_area("Input text to summarize")
|
| 7 |
+
user_limit=int(len(input.split("."))/5)
|
| 8 |
+
doc=nlp(input)
|
| 9 |
+
output=""
|
| 10 |
+
if st.button("Summarize"):
|
| 11 |
+
for i in doc._.textrank.summary(limit_sentences=user_limit):
|
| 12 |
+
a=i.text
|
| 13 |
+
output=output+a
|
| 14 |
+
st.markdown(output)
|
| 15 |
+
st.text("Length of Article="+str(len(input.split()))+" words")
|
| 16 |
+
st.text("Length of summary="+str(len(output.split()))+" words")
|