import streamlit as st import utils ########## Title for the Web App ########## st.title("Text Classification for Service Feedback") ########## Create Input field ########## feedback = st.text_input('Type your text here', 'The staff were extremely polite and helpful!') if st.button('Click for predictions!'): with st.spinner('Generating predictions...'): result = get_single_prediction(feedback) st.success(f'Your text has been predicted to fall under the following labels: {result[:-1]}. This text is {result[-1]}.') st.text('Or... Upload a csv file if you have many texts') uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.") if uploaded_file is not None: with st.spinner('Generating predictions...'): results = get_multiple_predictions(uploaded_file) st.download_button( label="Download results as CSV", data=results, file_name='results.csv', mime='text/csv', )