Last active
September 6, 2021 16:43
-
-
Save quickcode00/a364bfcd084eaf7748064ae901663d53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
st.title('News Summarizer') | |
# Gives option between top stories and search term | |
search_choice = st.sidebar.radio('', options=['Top Headlines', 'Search Term']) | |
# Takes user input for max number of sentences per summary | |
sentences_count = st.sidebar.slider('Max sentences per summary:', min_value=1, | |
max_value=10, | |
value=3) | |
# If user selects 'Top Headlines', a category dropdown will appear | |
if search_choice == 'Top Headlines': | |
category = st.sidebar.selectbox('Category:', options=['business', | |
'entertainment', | |
'general', | |
'health', | |
'science', | |
'sports', | |
'technology'], index=2) | |
st.write(f'you will see articles about {category} here') | |
# This is where we will call get_top_headlines() | |
# If user selects 'Search Term', a text input box will appear | |
elif search_choice == 'Search Term': | |
search_term = st.sidebar.text_input('Enter Search Term:') | |
if not search_term: | |
st.write('Please enter a search term =)') | |
else: | |
st.write(f'you will see articles about {search_term} here') | |
# This is where you will call search_articles() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment