Spaces:
Runtime error
Runtime error
added sample file
Browse files- .ipynb_checkpoints/app-checkpoint.py +9 -2
- .ipynb_checkpoints/utils-checkpoint.py +2 -0
- app.py +9 -2
- sample.csv +2 -0
- tester.ipynb +0 -49
- utils.py +2 -0
.ipynb_checkpoints/app-checkpoint.py
CHANGED
|
@@ -12,14 +12,21 @@ 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 topics: {result[:-1]}.
|
| 16 |
|
| 17 |
st.write("\n")
|
| 18 |
-
st.subheader('Or... Upload a csv file if you have
|
| 19 |
st.write("\n")
|
| 20 |
|
| 21 |
uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.")
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
if uploaded_file is not None:
|
| 24 |
|
| 25 |
with st.spinner('Generating predictions...'):
|
|
|
|
| 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.write("\n")
|
| 18 |
+
st.subheader('Or... Upload a csv file if you have a file instead.')
|
| 19 |
st.write("\n")
|
| 20 |
|
| 21 |
uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.")
|
| 22 |
|
| 23 |
+
st.download_button(
|
| 24 |
+
label="Download sample file here",
|
| 25 |
+
data=sample_file,
|
| 26 |
+
file_name='sample_results.csv',
|
| 27 |
+
mime='text/csv',
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
if uploaded_file is not None:
|
| 31 |
|
| 32 |
with st.spinner('Generating predictions...'):
|
.ipynb_checkpoints/utils-checkpoint.py
CHANGED
|
@@ -18,6 +18,8 @@ labels = [
|
|
| 18 |
'facilities', 'location', 'price'
|
| 19 |
]
|
| 20 |
|
|
|
|
|
|
|
| 21 |
def get_sentiment_label_facebook(list_of_sent_dicts):
|
| 22 |
if list_of_sent_dicts['labels'][0] == 'negative':
|
| 23 |
return 'negative'
|
|
|
|
| 18 |
'facilities', 'location', 'price'
|
| 19 |
]
|
| 20 |
|
| 21 |
+
sample_file = pd.read_csv('sample.csv')
|
| 22 |
+
|
| 23 |
def get_sentiment_label_facebook(list_of_sent_dicts):
|
| 24 |
if list_of_sent_dicts['labels'][0] == 'negative':
|
| 25 |
return 'negative'
|
app.py
CHANGED
|
@@ -12,14 +12,21 @@ 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 topics: {result[:-1]}.
|
| 16 |
|
| 17 |
st.write("\n")
|
| 18 |
-
st.subheader('Or... Upload a csv file if you have
|
| 19 |
st.write("\n")
|
| 20 |
|
| 21 |
uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.")
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
if uploaded_file is not None:
|
| 24 |
|
| 25 |
with st.spinner('Generating predictions...'):
|
|
|
|
| 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.write("\n")
|
| 18 |
+
st.subheader('Or... Upload a csv file if you have a file instead.')
|
| 19 |
st.write("\n")
|
| 20 |
|
| 21 |
uploaded_file = st.file_uploader("Please upload a csv file with only 1 column of texts.")
|
| 22 |
|
| 23 |
+
st.download_button(
|
| 24 |
+
label="Download sample file here",
|
| 25 |
+
data=sample_file,
|
| 26 |
+
file_name='sample_results.csv',
|
| 27 |
+
mime='text/csv',
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
if uploaded_file is not None:
|
| 31 |
|
| 32 |
with st.spinner('Generating predictions...'):
|
sample.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sequence
|
| 2 |
+
The website was user friendly and the agent provided good solutions
|
tester.ipynb
DELETED
|
@@ -1,49 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "code",
|
| 5 |
-
"execution_count": null,
|
| 6 |
-
"id": "48c76726-b0a4-43e6-9f07-0199e0248d5e",
|
| 7 |
-
"metadata": {},
|
| 8 |
-
"outputs": [],
|
| 9 |
-
"source": []
|
| 10 |
-
},
|
| 11 |
-
{
|
| 12 |
-
"cell_type": "code",
|
| 13 |
-
"execution_count": 39,
|
| 14 |
-
"id": "bd2034e6-1187-4887-9ca7-8b9c0b5c9331",
|
| 15 |
-
"metadata": {},
|
| 16 |
-
"outputs": [],
|
| 17 |
-
"source": []
|
| 18 |
-
},
|
| 19 |
-
{
|
| 20 |
-
"cell_type": "code",
|
| 21 |
-
"execution_count": null,
|
| 22 |
-
"id": "1ac414f1-37dd-4642-867c-5520a16c1c86",
|
| 23 |
-
"metadata": {},
|
| 24 |
-
"outputs": [],
|
| 25 |
-
"source": []
|
| 26 |
-
}
|
| 27 |
-
],
|
| 28 |
-
"metadata": {
|
| 29 |
-
"kernelspec": {
|
| 30 |
-
"display_name": "Python 3",
|
| 31 |
-
"language": "python",
|
| 32 |
-
"name": "python3"
|
| 33 |
-
},
|
| 34 |
-
"language_info": {
|
| 35 |
-
"codemirror_mode": {
|
| 36 |
-
"name": "ipython",
|
| 37 |
-
"version": 3
|
| 38 |
-
},
|
| 39 |
-
"file_extension": ".py",
|
| 40 |
-
"mimetype": "text/x-python",
|
| 41 |
-
"name": "python",
|
| 42 |
-
"nbconvert_exporter": "python",
|
| 43 |
-
"pygments_lexer": "ipython3",
|
| 44 |
-
"version": "3.8.8"
|
| 45 |
-
}
|
| 46 |
-
},
|
| 47 |
-
"nbformat": 4,
|
| 48 |
-
"nbformat_minor": 5
|
| 49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utils.py
CHANGED
|
@@ -18,6 +18,8 @@ labels = [
|
|
| 18 |
'facilities', 'location', 'price'
|
| 19 |
]
|
| 20 |
|
|
|
|
|
|
|
| 21 |
def get_sentiment_label_facebook(list_of_sent_dicts):
|
| 22 |
if list_of_sent_dicts['labels'][0] == 'negative':
|
| 23 |
return 'negative'
|
|
|
|
| 18 |
'facilities', 'location', 'price'
|
| 19 |
]
|
| 20 |
|
| 21 |
+
sample_file = pd.read_csv('sample.csv')
|
| 22 |
+
|
| 23 |
def get_sentiment_label_facebook(list_of_sent_dicts):
|
| 24 |
if list_of_sent_dicts['labels'][0] == 'negative':
|
| 25 |
return 'negative'
|