ArnoBen commited on
Commit
b90cadd
·
1 Parent(s): e99cf64

Updated requirements and gradio sdk calls

Browse files
Files changed (2) hide show
  1. app.py +4 -4
  2. requirements.txt +3 -3
app.py CHANGED
@@ -37,7 +37,7 @@ def detect_closed_eyes(img: np.ndarray) -> Tuple[np.ndarray, str]:
37
  str: Whether the eyes are opened or closed.
38
  """
39
  if img is None:
40
- return
41
 
42
  cv2.imwrite('test.jpg', img)
43
  detector = ClosedEyesDetector(InferenceConfig())
@@ -64,7 +64,7 @@ def detect_blur(img: np.ndarray) -> Tuple[np.ndarray, str]:
64
  str: Whether the input image is blurry
65
  """
66
  if img is None:
67
- return
68
 
69
  cfg = BlurrinessConfig()
70
  be = BlurrinessEstimator(cfg)
@@ -83,7 +83,7 @@ with demo:
83
  with gr.TabItem("Detect closed eyes"):
84
  with gr.Row():
85
  with gr.Column():
86
- eye_cam_input = gr.Webcam(streaming=True, mirror_webcam=False)
87
  eyes_button = gr.Button("Detect")
88
  with gr.Column():
89
  detection_output = gr.Image(label="Detection result (sorry for the creepiness)")
@@ -91,7 +91,7 @@ with demo:
91
  with gr.TabItem("Estimate blur"):
92
  with gr.Row():
93
  with gr.Column():
94
- blur_cam_input = gr.Webcam(streaming=True, mirror_webcam=False)
95
  blur_button = gr.Button("Estimate blur")
96
  with gr.Column():
97
  laplacian_output = gr.Image(label="Laplacian filter view")
 
37
  str: Whether the eyes are opened or closed.
38
  """
39
  if img is None:
40
+ raise ValueError("No image provided")
41
 
42
  cv2.imwrite('test.jpg', img)
43
  detector = ClosedEyesDetector(InferenceConfig())
 
64
  str: Whether the input image is blurry
65
  """
66
  if img is None:
67
+ raise ValueError("No image provided")
68
 
69
  cfg = BlurrinessConfig()
70
  be = BlurrinessEstimator(cfg)
 
83
  with gr.TabItem("Detect closed eyes"):
84
  with gr.Row():
85
  with gr.Column():
86
+ eye_cam_input = gr.Image(sources=["webcam"], streaming=True, mirror_webcam=False)
87
  eyes_button = gr.Button("Detect")
88
  with gr.Column():
89
  detection_output = gr.Image(label="Detection result (sorry for the creepiness)")
 
91
  with gr.TabItem("Estimate blur"):
92
  with gr.Row():
93
  with gr.Column():
94
+ blur_cam_input = gr.Image(sources=["webcam"], streaming=True, mirror_webcam=False)
95
  blur_button = gr.Button("Estimate blur")
96
  with gr.Column():
97
  laplacian_output = gr.Image(label="Laplacian filter view")
requirements.txt CHANGED
@@ -1,12 +1,12 @@
1
- gradio==3.17.1
2
  matplotlib==3.5.2
3
- mediapipe==0.9.0.1
4
  numpy==1.21.5
5
  opencv-contrib-python==4.6.0.66
6
  opencv-python==4.6.0.66
7
  pandas==1.3.5
8
  pillow==9.3.0
9
- pyqt5==5.15.8
10
  pytorch-lightning==1.9.0
11
  scikit-learn==1.0.2
12
  seaborn==0.12.2
 
1
+ gradio==4.9.1
2
  matplotlib==3.5.2
3
+ mediapipe==0.10
4
  numpy==1.21.5
5
  opencv-contrib-python==4.6.0.66
6
  opencv-python==4.6.0.66
7
  pandas==1.3.5
8
  pillow==9.3.0
9
+ pyqt5==5.15.10
10
  pytorch-lightning==1.9.0
11
  scikit-learn==1.0.2
12
  seaborn==0.12.2