Spaces:
Sleeping
Sleeping
NTAMBARA Etienne
commited on
Commit
·
42c7197
1
Parent(s):
935b026
Changes Made Keys p3
Browse files
app.py
CHANGED
@@ -65,14 +65,30 @@ def recognize_face(input_image):
|
|
65 |
pil_img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
|
66 |
return pil_img, results
|
67 |
|
68 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
iface = gr.Interface(
|
70 |
-
fn=
|
71 |
-
inputs=gr.Image(type="pil"),
|
72 |
-
outputs=[gr.Image(type="pil"), gr.
|
73 |
-
title="Face Recognition Attendance System",
|
74 |
-
description="
|
75 |
)
|
76 |
|
77 |
if __name__ == "__main__":
|
78 |
-
iface.launch(debug=True,inline=False)
|
|
|
65 |
pil_img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
|
66 |
return pil_img, results
|
67 |
|
68 |
+
# Define a function to handle webcam images
|
69 |
+
def process_webcam_image(image):
|
70 |
+
# Convert the base64 image to a format that can be processed
|
71 |
+
# Process the image through the face recognition function
|
72 |
+
return recognize_face(image)
|
73 |
+
# # Gradio interface
|
74 |
+
# iface = gr.Interface(
|
75 |
+
# fn=recognize_face,
|
76 |
+
# inputs=gr.Image(type="pil"),
|
77 |
+
# outputs=[gr.Image(type="pil"), gr.JSON(label="Student Information")],
|
78 |
+
# title="Face Recognition Attendance System",
|
79 |
+
# description="Upload an image to identify individuals."
|
80 |
+
# )
|
81 |
+
|
82 |
+
# if __name__ == "__main__":
|
83 |
+
# iface.launch(debug=True,inline=False)
|
84 |
+
# Create the Gradio interface
|
85 |
iface = gr.Interface(
|
86 |
+
fn=process_webcam_image,
|
87 |
+
inputs=gr.inputs.Image(source="webcam", type="pil", tool="editor"),
|
88 |
+
outputs=[gr.outputs.Image(type="pil"), gr.outputs.Label()],
|
89 |
+
title="Real-time Face Recognition Attendance System",
|
90 |
+
description="Activate your webcam and take a photo to check attendance."
|
91 |
)
|
92 |
|
93 |
if __name__ == "__main__":
|
94 |
+
iface.launch(share=True,debug=True,inline=False)
|