Spaces:
Runtime error
Runtime error
Commit
·
5078a35
1
Parent(s):
bd5a281
Update app.py
Browse files
app.py
CHANGED
@@ -68,9 +68,9 @@ def decide(text):
|
|
68 |
lr_result,
|
69 |
lstm_result,
|
70 |
bert_result]
|
71 |
-
if lstm_result >= 0.6:
|
72 |
return "Positive review (LR: {}, LSTM: {:.2}, BERT: {:.2}".format(*results)
|
73 |
-
elif lstm_result <= 0.4:
|
74 |
return "Negative review (LR: {}, LSTM: {:.2}, BERT: {:.2}".format(*results)
|
75 |
else:
|
76 |
return "Neutral review (LR: {}, LSTM: {:.2}, BERT: {:.2}".format(*results)
|
@@ -78,7 +78,21 @@ def decide(text):
|
|
78 |
|
79 |
example_sentence_1 = "I hate this toaster, they made no effort in making it. So cheap, it almost immediately broke!"
|
80 |
example_sentence_2 = "Great toaster! We love the way it toasted my bread so quickly. Very high quality components too."
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
description = "Write out a product review to know the underlying sentiment."
|
84 |
|
|
|
68 |
lr_result,
|
69 |
lstm_result,
|
70 |
bert_result]
|
71 |
+
if ((lr_result + lstm_result + bert_result) / 3) >= 0.6:
|
72 |
return "Positive review (LR: {}, LSTM: {:.2}, BERT: {:.2}".format(*results)
|
73 |
+
elif ((lr_result + lstm_result + bert_result) / 3) <= 0.4:
|
74 |
return "Negative review (LR: {}, LSTM: {:.2}, BERT: {:.2}".format(*results)
|
75 |
else:
|
76 |
return "Neutral review (LR: {}, LSTM: {:.2}, BERT: {:.2}".format(*results)
|
|
|
78 |
|
79 |
example_sentence_1 = "I hate this toaster, they made no effort in making it. So cheap, it almost immediately broke!"
|
80 |
example_sentence_2 = "Great toaster! We love the way it toasted my bread so quickly. Very high quality components too."
|
81 |
+
example_sentence_3 = "Packaging was all torn and crushed. Planned on giving as Christmas gifts. Cheaply made " \
|
82 |
+
"material. Only flips one way. Terrible product!"
|
83 |
+
example_sentence_4 = "An epic undertaking and delivered with sophistication and style... " \
|
84 |
+
"an engaging and thought provoking read!"
|
85 |
+
example_sentence_5 = "Tried to bond a part of a foil that was damage but this adhesive is too weak in the bond it " \
|
86 |
+
"forms between these two materials. Will Crack upon any kind of force that gets applied even " \
|
87 |
+
"after letting it cure for a few days."
|
88 |
+
example_sentence_6 = "I really love this toothpaste. It does not have floride or xylitol. A big plus is my teeth feel " \
|
89 |
+
"cleaner with this toothpaste after brushing than with any other toothpaste I have ever had."
|
90 |
+
examples = [[example_sentence_1],
|
91 |
+
[example_sentence_2],
|
92 |
+
[example_sentence_3],
|
93 |
+
[example_sentence_4],
|
94 |
+
[example_sentence_5],
|
95 |
+
[example_sentence_6]]
|
96 |
|
97 |
description = "Write out a product review to know the underlying sentiment."
|
98 |
|