updated app.py
Browse files
README.md
CHANGED
@@ -10,5 +10,4 @@ pinned: false
|
|
10 |
license: bsd-3-clause-clear
|
11 |
---
|
12 |
|
13 |
-
#
|
14 |
-
Setting up a Hugging Face Spaces Demo using Streamlit
|
|
|
10 |
license: bsd-3-clause-clear
|
11 |
---
|
12 |
|
13 |
+
# Face Emotion Recognition Demo with Web App using Hugging Face Spaces
|
|
app.py
CHANGED
@@ -49,7 +49,7 @@ if caffe_cache_key in st.session_state and onnx_cache_key in st.session_state:
|
|
49 |
else:
|
50 |
# Read ONNX model
|
51 |
model = 'onnx_model.onnx'
|
52 |
-
model = cv2.dnn.readNetFromONNX(
|
53 |
st.session_state[onnx_cache_key] = model
|
54 |
# Read the Caffe face detector.
|
55 |
net = cv2.dnn.readNetFromCaffe(str(PROTOTXT_LOCAL_PATH), str(CAFFE_MODEL_LOCAL_PATH))
|
@@ -259,9 +259,7 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
259 |
boxes, scores = net.forward(["boxes", "scores"])
|
260 |
boxes = np.expand_dims(np.reshape(boxes, (-1, 4)), axis=0)
|
261 |
scores = np.expand_dims(np.reshape(scores, (-1, 2)), axis=0)
|
262 |
-
boxes = convert_locations_to_boxes(
|
263 |
-
boxes, priors, center_variance, size_variance
|
264 |
-
)
|
265 |
boxes = center_form_to_corner_form(boxes)
|
266 |
boxes, labels, probs = predict(
|
267 |
img_ori.shape[1],
|
|
|
49 |
else:
|
50 |
# Read ONNX model
|
51 |
model = 'onnx_model.onnx'
|
52 |
+
model = cv2.dnn.readNetFromONNX(str(ONNX_MODEL_LOCAL_PATH))
|
53 |
st.session_state[onnx_cache_key] = model
|
54 |
# Read the Caffe face detector.
|
55 |
net = cv2.dnn.readNetFromCaffe(str(PROTOTXT_LOCAL_PATH), str(CAFFE_MODEL_LOCAL_PATH))
|
|
|
259 |
boxes, scores = net.forward(["boxes", "scores"])
|
260 |
boxes = np.expand_dims(np.reshape(boxes, (-1, 4)), axis=0)
|
261 |
scores = np.expand_dims(np.reshape(scores, (-1, 2)), axis=0)
|
262 |
+
boxes = convert_locations_to_boxes(boxes, priors, center_variance, size_variance)
|
|
|
|
|
263 |
boxes = center_form_to_corner_form(boxes)
|
264 |
boxes, labels, probs = predict(
|
265 |
img_ori.shape[1],
|