Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,8 @@ from PIL import Image
|
|
5 |
import sqlite3
|
6 |
import cv2
|
7 |
import numpy as np
|
8 |
-
from tensorflow.keras.models import load_model
|
9 |
-
from datetime import datetime
|
10 |
-
|
11 |
|
12 |
# Constants
|
13 |
HOME_DIR = os.getcwd() # Home directory to save images (root directory)
|
@@ -37,7 +36,14 @@ except Exception as e:
|
|
37 |
|
38 |
# Load the emotion detection model
|
39 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
emotion_model = load_model(EMOTION_MODEL_FILE) # Load the emotion model
|
|
|
41 |
except Exception as e:
|
42 |
st.error(f"Error loading emotion model: {e}")
|
43 |
st.stop()
|
|
|
5 |
import sqlite3
|
6 |
import cv2
|
7 |
import numpy as np
|
8 |
+
from tensorflow.keras.models import load_model # Importing load_model
|
9 |
+
from datetime import datetime # Importing datetime
|
|
|
10 |
|
11 |
# Constants
|
12 |
HOME_DIR = os.getcwd() # Home directory to save images (root directory)
|
|
|
36 |
|
37 |
# Load the emotion detection model
|
38 |
try:
|
39 |
+
# Check if model file exists
|
40 |
+
if not os.path.exists(EMOTION_MODEL_FILE):
|
41 |
+
st.error(f"Error: Emotion model file '{EMOTION_MODEL_FILE}' not found!")
|
42 |
+
st.stop()
|
43 |
+
|
44 |
+
# Load the model
|
45 |
emotion_model = load_model(EMOTION_MODEL_FILE) # Load the emotion model
|
46 |
+
st.success("Emotion detection model loaded successfully!")
|
47 |
except Exception as e:
|
48 |
st.error(f"Error loading emotion model: {e}")
|
49 |
st.stop()
|