Upload prediction_compile.py
Browse files- src/prediction_compile.py +21 -0
src/prediction_compile.py
CHANGED
|
@@ -119,10 +119,31 @@ def run():
|
|
| 119 |
)
|
| 120 |
|
| 121 |
with st.form(key='SQ-sentiment-analysis'):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
text = st.text_input('Customer Review', value='--customer review--')
|
|
|
|
|
|
|
|
|
|
| 123 |
submitted = st.form_submit_button('Predict')
|
| 124 |
|
| 125 |
if submitted:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
# Preprocess
|
| 127 |
processed = text_preprocessing(text)
|
| 128 |
seq = tokenizer.texts_to_sequences([processed])
|
|
|
|
| 119 |
)
|
| 120 |
|
| 121 |
with st.form(key='SQ-sentiment-analysis'):
|
| 122 |
+
date = st.date_input("Review Date")
|
| 123 |
+
platform = st.selectbox('Review Platform', ('Mobile', 'Desktop'), index=0)
|
| 124 |
+
rating = st.number_input('Rating', min_value=0, max_value=5, value=3, step=1)
|
| 125 |
+
st.markdown('---')
|
| 126 |
text = st.text_input('Customer Review', value='--customer review--')
|
| 127 |
+
title = st.text_input('Review Title', value='--review title--')
|
| 128 |
+
vote = st.slider('Helpful Vote', min_value=0, max_value=200, value=50, step=1)
|
| 129 |
+
st.markdown('---')
|
| 130 |
submitted = st.form_submit_button('Predict')
|
| 131 |
|
| 132 |
if submitted:
|
| 133 |
+
st.markdown("---")
|
| 134 |
+
st.write("### Input Data")
|
| 135 |
+
data_inf = {
|
| 136 |
+
'published_date': date,
|
| 137 |
+
'published_platform': platform,
|
| 138 |
+
'rating': rating,
|
| 139 |
+
'type': 'Review',
|
| 140 |
+
'text': text,
|
| 141 |
+
'title': title,
|
| 142 |
+
'helpful_votes': vote
|
| 143 |
+
}
|
| 144 |
+
st.dataframe(pd.DataFrame([data_inf]))
|
| 145 |
+
|
| 146 |
+
|
| 147 |
# Preprocess
|
| 148 |
processed = text_preprocessing(text)
|
| 149 |
seq = tokenizer.texts_to_sequences([processed])
|