-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.py
29 lines (23 loc) · 945 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Core packages
# NLP packages
import nltk
import streamlit as st
from src.tf_idf import run_summarization_tf_idf
from src.word_frequency import run_summarization_wf
if __name__ == '__main__':
nltk.download('punkt')
nltk.download('stopwords')
st.header("Text Summarization using TF-IDF and WordFrequency Algorithms")
st.subheader("This app will summarize the long piece of input text in a few sentences")
st.subheader("Paste your long text below:")
text = st.text_area(label="Input text")
if st.button("Summarize"):
if text:
summary_result = run_summarization_tf_idf(text)
st.subheader("Using TF-IDF Algorithm:")
st.success(summary_result)
summary_result = run_summarization_wf(text)
st.subheader("Using WordFrequency Algorithm:")
st.success(summary_result)
else:
st.error("Please paste or write(!) some text")