Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -53,11 +53,6 @@ class RNN(nn.Cell):
|
|
53 |
output = self.fc(hidden)
|
54 |
return self.sigmoid(output)
|
55 |
|
56 |
-
score_map = {
|
57 |
-
1: "Positive",
|
58 |
-
0: "Negative"
|
59 |
-
}
|
60 |
-
|
61 |
def predict_sentiment(model, vocab, sentence):
|
62 |
model.set_train(False)
|
63 |
tokenized = sentence.lower().split()
|
@@ -87,7 +82,7 @@ def prefict_emotion(sentence):
|
|
87 |
load_param_into_net(net, param_dict)
|
88 |
|
89 |
# ι’ζ΅
|
90 |
-
pred = predict_sentiment(net, vocab, sentence)
|
91 |
result = {
|
92 |
"Positive π": pred,
|
93 |
"Negative π": 1-pred,
|
|
|
53 |
output = self.fc(hidden)
|
54 |
return self.sigmoid(output)
|
55 |
|
|
|
|
|
|
|
|
|
|
|
56 |
def predict_sentiment(model, vocab, sentence):
|
57 |
model.set_train(False)
|
58 |
tokenized = sentence.lower().split()
|
|
|
82 |
load_param_into_net(net, param_dict)
|
83 |
|
84 |
# ι’ζ΅
|
85 |
+
pred = predict_sentiment(net, vocab, sentence).item()
|
86 |
result = {
|
87 |
"Positive π": pred,
|
88 |
"Negative π": 1-pred,
|