app.py
app.py
import cv2
import streamlit as st
from utils import get_face_landmarks
import tempfile
import os
# Webcam input
frame_holder = st.empty()
cap = cv2.VideoCapture(0)
if not cap.isOpened():
st.error("Error: Could not open webcam.")
else:
st.text("Press 'q' to stop the webcam feed.")
while True:
ret, frame = cap.read()
if not ret:
st.error("Failed to capture image")
break
# Display emotion
cv2.putText(frame,
emotions[int(output[0])],
(10, frame.shape[0] - 10),
cv2.FONT_HERSHEY_SIMPLEX,
1,
(0, 255, 0),
2)
cap.release()
cv2.destroyAllWindows()