app.py
app.py
import cv2
from keras.models import model_from_json
import numpy as np
import tensorflow as tf
from PIL import Image
# Emotion labels
labels = {0: 'angry', 1: 'disgust', 2: 'fear', 3: 'happy', 4: 'neutral', 5: 'sad',
6: 'surprise'}
return frame
# Streamlit UI elements
st.title("Facial Emotion Recognition")
st.write("Webcam live feed with emotion prediction.")
if video_stream:
# Get image from the Streamlit camera input
frame = video_stream.getvalue()
np_frame = np.frombuffer(frame, dtype=np.uint8)
frame = cv2.imdecode(np_frame, 1)