pushpinder06 commited on
Commit
f1910ed
·
verified ·
1 Parent(s): 9657d07

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -7,8 +7,9 @@ face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_fronta
7
 
8
  # Face Detection Function
9
  def detect_faces(image_np):
 
10
  # Convert image to grayscale
11
- gray_image = cv2.cvtColor(image_np, cv2.COLOR_RGB2GRAY)
12
 
13
  # Detect faces
14
  faces = face_cascade.detectMultiScale(gray_image, scaleFactor=1.1, minNeighbors=5, minSize=(30, 30))
@@ -17,7 +18,7 @@ def detect_faces(image_np):
17
  for (x, y, w, h) in faces:
18
  cv2.rectangle(image_np, (x, y), (x + w, y + h), (0, 255, 0), 2)
19
 
20
- return image_np
21
 
22
  # Create Gradio Interface
23
  iface = gr.Interface(
 
7
 
8
  # Face Detection Function
9
  def detect_faces(image_np):
10
+ img=np.array(gray_image)
11
  # Convert image to grayscale
12
+ gray_image = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
13
 
14
  # Detect faces
15
  faces = face_cascade.detectMultiScale(gray_image, scaleFactor=1.1, minNeighbors=5, minSize=(30, 30))
 
18
  for (x, y, w, h) in faces:
19
  cv2.rectangle(image_np, (x, y), (x + w, y + h), (0, 255, 0), 2)
20
 
21
+ return img
22
 
23
  # Create Gradio Interface
24
  iface = gr.Interface(