panik commited on
Commit
5e803d9
1 Parent(s): 4296598

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
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
- #inputs='image',
61
- inputs="webcam",
62
  outputs='image',
63
- title='Facial Expression',
64
- description='Facial expression detection test')
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()