Spaces:
Sleeping
Sleeping
Commit ·
10e5f20
1
Parent(s): f7d313c
Update functions.py
Browse files- functions.py +10 -9
functions.py
CHANGED
|
@@ -40,12 +40,13 @@ def text_model(df):
|
|
| 40 |
return df['preprocessed_text']
|
| 41 |
|
| 42 |
def prediction(model, X):
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
| 40 |
return df['preprocessed_text']
|
| 41 |
|
| 42 |
def prediction(model, X):
|
| 43 |
+
model = load_model('best_model.keras')
|
| 44 |
+
y_pred = model.predict(X)
|
| 45 |
+
predictions = np.argmax(y_pred, axis=1)
|
| 46 |
+
for index, val in enumerate(predictions):
|
| 47 |
+
if val == 0:
|
| 48 |
+
return f"Text {index} indicates the person is feeling FEAR"
|
| 49 |
+
elif val == 1:
|
| 50 |
+
return f"Text {index} indicates the person is feeling ANGER"
|
| 51 |
+
else:
|
| 52 |
+
return f"Text {index} indicates the person is feeling JOY"
|