Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import cv2
|
| 3 |
import numpy as np
|
|
@@ -14,10 +17,6 @@ emotions = ('angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral')
|
|
| 14 |
|
| 15 |
# Define the frame scaling factor
|
| 16 |
scaling_factor = 1.0
|
| 17 |
-
|
| 18 |
-
def blur_image(img):
|
| 19 |
-
blur = cv2.blur(img,(10, 10))
|
| 20 |
-
return blur
|
| 21 |
|
| 22 |
def process_image(img):
|
| 23 |
# Resize the frame
|
|
@@ -57,10 +56,9 @@ def process_image(img):
|
|
| 57 |
|
| 58 |
interface = gr.Interface(
|
| 59 |
fn = process_image,
|
| 60 |
-
|
| 61 |
-
inputs="webcam",
|
| 62 |
outputs='image',
|
| 63 |
-
title='Facial Expression',
|
| 64 |
-
description='
|
| 65 |
|
| 66 |
interface.launch()
|
|
|
|
| 1 |
+
# code adapted from Sefik Ilkin Serengil's Facial Expression Recognition with Keras tutorial
|
| 2 |
+
# https://raw.githubusercontent.com/serengil/tensorflow-101/master/python/emotion-analysis-from-video.py
|
| 3 |
+
|
| 4 |
import gradio as gr
|
| 5 |
import cv2
|
| 6 |
import numpy as np
|
|
|
|
| 17 |
|
| 18 |
# Define the frame scaling factor
|
| 19 |
scaling_factor = 1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
def process_image(img):
|
| 22 |
# Resize the frame
|
|
|
|
| 56 |
|
| 57 |
interface = gr.Interface(
|
| 58 |
fn = process_image,
|
| 59 |
+
inputs='webcam',
|
|
|
|
| 60 |
outputs='image',
|
| 61 |
+
title='Facial Expression Detection',
|
| 62 |
+
description='Simple facial expression detection example with OpenCV, using a CNN model pre-trained on the FER 2013 dataset.')
|
| 63 |
|
| 64 |
interface.launch()
|