Update app.py
Browse files
app.py
CHANGED
@@ -153,13 +153,13 @@ def main():
|
|
153 |
#prediction = loaded_model.predict(input_vector)[0]
|
154 |
prediction_1 = round(proba_1[0])
|
155 |
end_time = time.time()
|
|
|
156 |
# Display the predicted sentiment
|
157 |
if prediction_1 == 0:
|
158 |
st.write('The sentiment of your review is negative.')
|
159 |
st.write('Predicted probability:', (1 - round(proba_1[0], 2))*100, '%')
|
160 |
else:
|
161 |
st.write('The sentiment of your review is positive.')
|
162 |
-
st.write('Predicted probability:', (round(proba_1[0], 2))*100, '%')
|
163 |
st.write('Processing time:', round(end_time - start_time, 4), 'seconds')
|
164 |
# Lena
|
165 |
if user_input is not None and submit:
|
@@ -169,6 +169,7 @@ def main():
|
|
169 |
input_tokens = preprocess_text(user_input, 500, tokenizer)
|
170 |
output = predict_sentiment(model2, input_tokens)
|
171 |
end_time = time.time()
|
|
|
172 |
st.write('The sentiment of your review is', output)
|
173 |
st.write('Processing time:', round(end_time - start_time, 4), 'seconds')
|
174 |
# Gala
|
@@ -178,6 +179,7 @@ def main():
|
|
178 |
start_time = time.time()
|
179 |
output = predict_sentence(user_input,model3)
|
180 |
end_time = time.time()
|
|
|
181 |
st.write('The sentiment of your review is', output)
|
182 |
st.write('Processing time:', round(end_time - start_time, 4), 'seconds')
|
183 |
|
|
|
153 |
#prediction = loaded_model.predict(input_vector)[0]
|
154 |
prediction_1 = round(proba_1[0])
|
155 |
end_time = time.time()
|
156 |
+
st.header('Classic ML (LogReg on TF-IDF)')
|
157 |
# Display the predicted sentiment
|
158 |
if prediction_1 == 0:
|
159 |
st.write('The sentiment of your review is negative.')
|
160 |
st.write('Predicted probability:', (1 - round(proba_1[0], 2))*100, '%')
|
161 |
else:
|
162 |
st.write('The sentiment of your review is positive.')
|
|
|
163 |
st.write('Processing time:', round(end_time - start_time, 4), 'seconds')
|
164 |
# Lena
|
165 |
if user_input is not None and submit:
|
|
|
169 |
input_tokens = preprocess_text(user_input, 500, tokenizer)
|
170 |
output = predict_sentiment(model2, input_tokens)
|
171 |
end_time = time.time()
|
172 |
+
st.header('ErnieModel')
|
173 |
st.write('The sentiment of your review is', output)
|
174 |
st.write('Processing time:', round(end_time - start_time, 4), 'seconds')
|
175 |
# Gala
|
|
|
179 |
start_time = time.time()
|
180 |
output = predict_sentence(user_input,model3)
|
181 |
end_time = time.time()
|
182 |
+
st.header('bidirectional LSTM')
|
183 |
st.write('The sentiment of your review is', output)
|
184 |
st.write('Processing time:', round(end_time - start_time, 4), 'seconds')
|
185 |
|