Views
No views yet
['angry', 'disgusted', 'fearful', 'happy', 'neutral', 'sad', 'surprised']pip install tensorflow opencv-python1from huggingface_hub import hf_hub_download
2from tensorflow.keras.models import load_model
3
4model_path = hf_hub_download(repo_id="shivampr1001/Emo0.1", filename="Emo0.1.h5")
5model = load_model(model_path)import cv2
import numpy as np
def predict_emotion(img_path):
img = cv2.imread(img_path)
img = cv2.resize(img, (48,48)).astype('float32')/255
pred = model.predict(np.expand_dims(img, axis=0))[0]
return ['angry','disgusted','fearful','happy','neutral','sad','surprised'][np.argmax(pred)]| File | Purpose |
|---|---|
facial_EmotionClassifer.h5 | Pre-trained Keras model |
RealTimeClassification.py | Webcam-based emotion prediction |
predictBY_img.py | Image-based emotion prediction |
haarcascade_frontalface_default.xml | Haar cascade for face detection |