Update app.py
Browse files
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
|
76 |
-
|
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"],
|
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,
|