Spaces:
Runtime error
Runtime error
update code
Browse files- .ipynb_checkpoints/app-checkpoint.py +4 -2
- .ipynb_checkpoints/utils-checkpoint.py +2 -2
- app.py +4 -2
- utils.py +2 -2
.ipynb_checkpoints/app-checkpoint.py
CHANGED
|
@@ -12,9 +12,11 @@ if st.button('Click for predictions!'):
|
|
| 12 |
|
| 13 |
result = get_single_prediction(feedback)
|
| 14 |
|
| 15 |
-
st.success(f'Your text has been predicted to fall under the following
|
| 16 |
|
| 17 |
-
st.text(
|
|
|
|
|
|
|
| 18 |
|
| 19 |
uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.")
|
| 20 |
|
|
|
|
| 12 |
|
| 13 |
result = get_single_prediction(feedback)
|
| 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 |
|
.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
|
| 98 |
else:
|
| 99 |
-
return pd.concat([final_results, invalid]).reset_index(drop=True)
|
|
|
|
| 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')
|
app.py
CHANGED
|
@@ -12,9 +12,11 @@ if st.button('Click for predictions!'):
|
|
| 12 |
|
| 13 |
result = get_single_prediction(feedback)
|
| 14 |
|
| 15 |
-
st.success(f'Your text has been predicted to fall under the following
|
| 16 |
|
| 17 |
-
st.text(
|
|
|
|
|
|
|
| 18 |
|
| 19 |
uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.")
|
| 20 |
|
|
|
|
| 12 |
|
| 13 |
result = get_single_prediction(feedback)
|
| 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 |
|
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
|
| 98 |
else:
|
| 99 |
-
return pd.concat([final_results, invalid]).reset_index(drop=True)
|
|
|
|
| 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')
|