|
import gradio as gr |
|
from PIL import Image |
|
from processing import process_image, generate_embeddings , recognize_faces |
|
|
|
def driver(image,zip_file): |
|
image.save('class_attendance.jpg') |
|
fig = process_image('class_attendance.jpg') |
|
generate_embeddings(zip_file) |
|
recognize_faces("embeddings.pkl") |
|
file_name = "Attendance.txt" |
|
image_detected = Image.open('image_detected.jpg') |
|
image_grid = Image.open('image_grid.jpg') |
|
return file_name,image_detected,image_grid |
|
|
|
|
|
|
|
with open("description.md", "r") as file: |
|
description_text = file.read() |
|
|
|
demo = gr.Interface( |
|
fn=driver, |
|
inputs=[gr.Image(label="Upload the image of group/class",type="pil"),gr.File(label="Upload ZIP file containing images of students/employees")], |
|
outputs=[gr.File(label="Download Attendance File"),gr.Image(label="Image with face detections"),"image"], |
|
title="Automated Attendance System", |
|
description=description_text, |
|
examples=[["abc1.jpg","friends.zip"],["abc2.jpg","friends.zip"]], |
|
article="<b>if you find any unexpected or wrong results please flag them so that we can improve our model for those type of inputs.<b>" |
|
) |
|
demo.launch(inline=False) |