Spaces:
Runtime error
Runtime error
Commit
·
ba1b8bc
1
Parent(s):
bf1ed1a
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,12 +13,16 @@ def decide(text):
|
|
| 13 |
tokenized_text = tokenizer.texts_to_sequences([text])
|
| 14 |
padded_tokens = pad_sequences(tokenized_text, maxlen= 200)
|
| 15 |
result = model.predict(padded_tokens, verbose=0)
|
| 16 |
-
if result[:]
|
| 17 |
-
output = "
|
|
|
|
|
|
|
| 18 |
else:
|
| 19 |
-
output = "
|
| 20 |
return output
|
| 21 |
|
|
|
|
|
|
|
| 22 |
example_sentence_1 = "I hate the movie, they made no effort in making the movie. Waste of time!"
|
| 23 |
example_sentence_2 = "Awesome movie! Loved the way in which the hero acted."
|
| 24 |
examples = [[example_sentence_1], [example_sentence_2]]
|
|
|
|
| 13 |
tokenized_text = tokenizer.texts_to_sequences([text])
|
| 14 |
padded_tokens = pad_sequences(tokenized_text, maxlen= 200)
|
| 15 |
result = model.predict(padded_tokens, verbose=0)
|
| 16 |
+
if result[:] > 0.6 :
|
| 17 |
+
output = f"Positive review with {result : .0%} confidence score"
|
| 18 |
+
elif result[:] < 0.4:
|
| 19 |
+
output = f"Negative review with {result : .0%} confidence score"
|
| 20 |
else:
|
| 21 |
+
output = "Neutral"
|
| 22 |
return output
|
| 23 |
|
| 24 |
+
|
| 25 |
+
|
| 26 |
example_sentence_1 = "I hate the movie, they made no effort in making the movie. Waste of time!"
|
| 27 |
example_sentence_2 = "Awesome movie! Loved the way in which the hero acted."
|
| 28 |
examples = [[example_sentence_1], [example_sentence_2]]
|