File size: 1,236 Bytes
00f8748
 
 
 
33e3fdb
00f8748
 
 
33e3fdb
 
00f8748
 
 
 
 
 
 
 
 
 
 
33e3fdb
00f8748
 
 
33e3fdb
00f8748
 
33e3fdb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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

# Define the Gradio interface
# Read the content of the .md file
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)