Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -46,6 +46,7 @@ BATCH_SIZE = 8
|
|
46 |
# Set Paths
|
47 |
data_path = 'employees'
|
48 |
model_path = 'vit_pytorch_GPU_1.pt'
|
|
|
49 |
|
50 |
# Set Title
|
51 |
st.title("Employee Attendance System")
|
@@ -171,10 +172,15 @@ prod_dl = DataLoader(prod_ds, batch_size=BATCH_SIZE)
|
|
171 |
|
172 |
# Read image from Camera
|
173 |
enable = st.checkbox("Enable camera")
|
174 |
-
|
175 |
-
if
|
|
|
|
|
|
|
|
|
|
|
176 |
# Create DataLoader for Webcam Image
|
177 |
-
webcam_ds = dataset_prod_obj.create_dataset(
|
178 |
webcam_dl = DataLoader(webcam_ds, batch_size=BATCH_SIZE)
|
179 |
|
180 |
# Run the predictions
|
|
|
46 |
# Set Paths
|
47 |
data_path = 'employees'
|
48 |
model_path = 'vit_pytorch_GPU_1.pt'
|
49 |
+
webcam_path = 'captured_image.jpg'
|
50 |
|
51 |
# Set Title
|
52 |
st.title("Employee Attendance System")
|
|
|
172 |
|
173 |
# Read image from Camera
|
174 |
enable = st.checkbox("Enable camera")
|
175 |
+
picture = st.camera_input("Take a picture", disabled=not enable)
|
176 |
+
if picture is not None:
|
177 |
+
img_bytes = picture.getvalue()
|
178 |
+
img = PIL.Image.open(img_bytes)
|
179 |
+
img.save(webcam_path, "JPEG")
|
180 |
+
st.write('Image saved as:',webcam_path)
|
181 |
+
|
182 |
# Create DataLoader for Webcam Image
|
183 |
+
webcam_ds = dataset_prod_obj.create_dataset(webcam_path)
|
184 |
webcam_dl = DataLoader(webcam_ds, batch_size=BATCH_SIZE)
|
185 |
|
186 |
# Run the predictions
|