Spaces:
Runtime error
Runtime error
MahmoudNasser
commited on
Commit
•
95dabf2
1
Parent(s):
7d7fd9c
Update main.py
Browse filesEmotion prediction
main.py
CHANGED
@@ -174,13 +174,11 @@ def modelsummary(data):
|
|
174 |
result = remove_punctuations(result)
|
175 |
return { 'summary':result}
|
176 |
|
177 |
-
def
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
return dict_labels
|
183 |
-
# return {"anger": .90, "happy": .02, "emotionlabel": "anger"}
|
184 |
|
185 |
#OTP code
|
186 |
def genereteotp (email):
|
|
|
174 |
result = remove_punctuations(result)
|
175 |
return { 'summary':result}
|
176 |
|
177 |
+
def predict(data):
|
178 |
+
map = {0:'anger', 1:'sadness', 2:'joy', 3:'surprise', 4:'love', 5:'sympathy', 6:'fear'}
|
179 |
+
text = txt_preprocess(data)
|
180 |
+
pred=model.predict(pd.Series([data]))
|
181 |
+
return map[np.argmax(pred,axis=-1)[0]]
|
|
|
|
|
182 |
|
183 |
#OTP code
|
184 |
def genereteotp (email):
|