ongkn commited on
Commit
a54f7cf
1 Parent(s): c412d9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -72,12 +72,11 @@ pipe = pipeline("image-classification", model=model, feature_extractor=processor
72
 
73
  def classify_image(input):
74
  face = grab_faces(np.array(input))
75
- if face is not None:
76
- x, y, w, h = face
77
- cv.rectangle(input, (x, y), (x + w, y + h), (255, 255, 0), 2)
78
  face = Image.fromarray(face)
79
  result = pipe(face)
80
- return result[0]["label"], result[0]["score"], input
81
 
82
  iface = gr.Interface(
83
  fn=classify_image,
 
72
 
73
  def classify_image(input):
74
  face = grab_faces(np.array(input))
75
+ if face is None:
76
+ return "No face detected", 0, input
 
77
  face = Image.fromarray(face)
78
  result = pipe(face)
79
+ return result[0]["label"], result[0]["score"], face
80
 
81
  iface = gr.Interface(
82
  fn=classify_image,