Spaces:
Runtime error
Runtime error
update code
Browse files- .ipynb_checkpoints/app-checkpoint.py +3 -1
- .ipynb_checkpoints/utils-checkpoint.py +2 -2
- app.py +3 -1
- utils.py +2 -2
.ipynb_checkpoints/app-checkpoint.py
CHANGED
@@ -5,7 +5,7 @@ from utils import *
|
|
5 |
st.title("Text Classification for Service Feedback")
|
6 |
|
7 |
########## Create Input field ##########
|
8 |
-
feedback = st.text_input('Type your text here', 'The
|
9 |
|
10 |
if st.button('Click for predictions!'):
|
11 |
with st.spinner('Generating predictions...'):
|
@@ -14,9 +14,11 @@ if st.button('Click for predictions!'):
|
|
14 |
|
15 |
st.success(f'Your text has been predicted to fall under the following topics: {result[:-1]}. The sentiment of this text is {result[-1]}.')
|
16 |
|
|
|
17 |
st.text("")
|
18 |
st.subheader('Or... Upload a csv file if you have many texts')
|
19 |
st.text("")
|
|
|
20 |
|
21 |
uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.")
|
22 |
|
|
|
5 |
st.title("Text Classification for Service Feedback")
|
6 |
|
7 |
########## Create Input field ##########
|
8 |
+
feedback = st.text_input('Type your text here', 'The website was user friendly and the agent provided good solutions')
|
9 |
|
10 |
if st.button('Click for predictions!'):
|
11 |
with st.spinner('Generating predictions...'):
|
|
|
14 |
|
15 |
st.success(f'Your text has been predicted to fall under the following topics: {result[:-1]}. The sentiment of this text is {result[-1]}.')
|
16 |
|
17 |
+
st.text("")
|
18 |
st.text("")
|
19 |
st.subheader('Or... Upload a csv file if you have many texts')
|
20 |
st.text("")
|
21 |
+
st.text("")
|
22 |
|
23 |
uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.")
|
24 |
|
.ipynb_checkpoints/utils-checkpoint.py
CHANGED
@@ -94,6 +94,6 @@ def get_multiple_predictions(csv):
|
|
94 |
|
95 |
# Append invalid rows
|
96 |
if len(invalid) == 0:
|
97 |
-
return final_results.to_csv().encode('utf-8')
|
98 |
else:
|
99 |
-
return pd.concat([final_results, invalid]).reset_index(drop=True).to_csv().encode('utf-8')
|
|
|
94 |
|
95 |
# Append invalid rows
|
96 |
if len(invalid) == 0:
|
97 |
+
return final_results.to_csv(index=False).encode('utf-8')
|
98 |
else:
|
99 |
+
return pd.concat([final_results, invalid]).reset_index(drop=True).to_csv(index=False).encode('utf-8')
|
app.py
CHANGED
@@ -5,7 +5,7 @@ from utils import *
|
|
5 |
st.title("Text Classification for Service Feedback")
|
6 |
|
7 |
########## Create Input field ##########
|
8 |
-
feedback = st.text_input('Type your text here', 'The
|
9 |
|
10 |
if st.button('Click for predictions!'):
|
11 |
with st.spinner('Generating predictions...'):
|
@@ -14,9 +14,11 @@ if st.button('Click for predictions!'):
|
|
14 |
|
15 |
st.success(f'Your text has been predicted to fall under the following topics: {result[:-1]}. The sentiment of this text is {result[-1]}.')
|
16 |
|
|
|
17 |
st.text("")
|
18 |
st.subheader('Or... Upload a csv file if you have many texts')
|
19 |
st.text("")
|
|
|
20 |
|
21 |
uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.")
|
22 |
|
|
|
5 |
st.title("Text Classification for Service Feedback")
|
6 |
|
7 |
########## Create Input field ##########
|
8 |
+
feedback = st.text_input('Type your text here', 'The website was user friendly and the agent provided good solutions')
|
9 |
|
10 |
if st.button('Click for predictions!'):
|
11 |
with st.spinner('Generating predictions...'):
|
|
|
14 |
|
15 |
st.success(f'Your text has been predicted to fall under the following topics: {result[:-1]}. The sentiment of this text is {result[-1]}.')
|
16 |
|
17 |
+
st.text("")
|
18 |
st.text("")
|
19 |
st.subheader('Or... Upload a csv file if you have many texts')
|
20 |
st.text("")
|
21 |
+
st.text("")
|
22 |
|
23 |
uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.")
|
24 |
|
utils.py
CHANGED
@@ -94,6 +94,6 @@ def get_multiple_predictions(csv):
|
|
94 |
|
95 |
# Append invalid rows
|
96 |
if len(invalid) == 0:
|
97 |
-
return final_results.to_csv().encode('utf-8')
|
98 |
else:
|
99 |
-
return pd.concat([final_results, invalid]).reset_index(drop=True).to_csv().encode('utf-8')
|
|
|
94 |
|
95 |
# Append invalid rows
|
96 |
if len(invalid) == 0:
|
97 |
+
return final_results.to_csv(index=False).encode('utf-8')
|
98 |
else:
|
99 |
+
return pd.concat([final_results, invalid]).reset_index(drop=True).to_csv(index=False).encode('utf-8')
|