|
import gradio as gr |
|
from PIL import Image |
|
from processing import process_image, generate_embeddings , recognize_faces |
|
|
|
def driver(image,zip_file,date): |
|
image.save('class_attendance.jpg') |
|
fig = process_image('class_attendance.jpg') |
|
generate_embeddings(zip_file) |
|
recognize_faces("embeddings.pkl",date) |
|
file_name = f"{date}.txt" |
|
|
|
with open(file_name, 'r') as file: |
|
content = file.read() |
|
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"),gr.Textbox(label="enter date")], |
|
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","01-03-2005"],["abc2.jpg","friends.zip","10-04-2006"]], |
|
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(share=False,inline=False) |