File size: 1,382 Bytes
00f8748
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
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

# 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"),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)