Spaces:
Runtime error
Runtime error
File size: 1,237 Bytes
deb200f a34ad6e deb200f 7fe3481 deb200f 73b620f deb200f c7563b2 73b620f c7563b2 deb200f 73b620f deb200f |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import streamlit as st
from utils import *
########## Title for the Web App ##########
st.title("Text Classification for Service Feedback")
########## Create Input field ##########
feedback = st.text_input('Type your text here', 'The website was user friendly and the agent provided good solutions')
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 topics: {result[:-1]}. The sentiment of this text is {result[-1]}.')
st.write("\n")
st.subheader('Or... Upload a csv file if you have a file instead.')
st.write("\n")
uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.")
st.download_button(
label="Download sample file here",
data=sample_file,
file_name='sample_results.csv',
mime='text/csv',
)
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',
)
|