Skip to content

Commit bb5c092

Browse files
Update summarize.py
1 parent e4f6a0c commit bb5c092

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pages/summarize.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ def summarize_text(input_text):
1717
summarized_text = summarizer(input_text, max_length=10050, min_length=50, do_sample=False)[0]['summary_text']
1818
return summarized_text
1919

20+
2021
# Function to analyze text and return metrics
2122
def analyze_text(input_text):
23+
2224
nltk.download('punkt')
2325
tokenized_words = word_tokenize(input_text)
2426
reading_time = readtime.of_text(input_text)
@@ -33,6 +35,7 @@ def analyze_text(input_text):
3335
}
3436
return analysis_results
3537

38+
3639
# Function to display the homepage
3740
def display_homepage():
3841
st.markdown("<h1 style='text-align: center; color: white; font-size:28px;'>Welcome to DarkGPT!🧨</h1>", unsafe_allow_html=True)
@@ -78,6 +81,7 @@ def display_homepage():
7881
# Display the footer
7982
st.markdown(footer, unsafe_allow_html=True)
8083

84+
8185
# Function to display the text summarization page
8286
def display_summarization_page():
8387
st.markdown("<h4 style='text-align: center; color:grey;'>Accelerate knowledge with DarkGPT &#129302;</h4>", unsafe_allow_html=True)
@@ -114,6 +118,7 @@ def display_summarization_page():
114118
st.success(summarized_text)
115119
st.balloons()
116120

121+
117122
# Function to display the text analysis page
118123
def display_analysis_page():
119124
st.markdown("<h4 style='text-align: center; color:grey;'>Accelerate knowledge with DarkGPT &#129302;</h4>", unsafe_allow_html=True)
@@ -156,6 +161,7 @@ def display_analysis_page():
156161
st.write('Number of Sentences:', analysis_results['num_sentences'])
157162
st.balloons()
158163

164+
159165
# Main function to run the Streamlit app
160166
def main():
161167
st.sidebar.header('DarkGPT, I want to :crystal_ball:')
@@ -170,5 +176,6 @@ def main():
170176
elif nav == 'Analyze text':
171177
display_analysis_page()
172178

179+
173180
if __name__ == "__main__":
174181
main()

0 commit comments

Comments
 (0)