Upload 3 files
Browse files- .gitattributes +1 -0
- Face Detector.keras +3 -0
- app.py +35 -0
- requirements.txt +5 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
Face[[:space:]]Detector.keras filter=lfs diff=lfs merge=lfs -text
|
Face Detector.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:370b02eb89ba790cfcd22ca37e0af54e69be109561cb62f76fc59c5e00ad3889
|
| 3 |
+
size 20720065
|
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import numpy as np
|
| 3 |
+
from keras.models import load_model
|
| 4 |
+
from keras.preprocessing import image
|
| 5 |
+
from PIL import Image
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
# Load the trained model
|
| 9 |
+
model = load_model("Face Detector.keras")
|
| 10 |
+
|
| 11 |
+
st.title("😷 Face Mask Detection App")
|
| 12 |
+
st.write("Upload an image and check if the person is wearing a mask.")
|
| 13 |
+
|
| 14 |
+
# File uploader
|
| 15 |
+
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
| 16 |
+
|
| 17 |
+
if uploaded_file is not None:
|
| 18 |
+
# Show uploaded image
|
| 19 |
+
img = Image.open(uploaded_file)
|
| 20 |
+
st.image(img, caption="Uploaded Image", use_column_width=True)
|
| 21 |
+
|
| 22 |
+
# Preprocess image
|
| 23 |
+
img = img.resize((200, 200))
|
| 24 |
+
img = image.img_to_array(img)
|
| 25 |
+
img = np.expand_dims(img, axis=0)
|
| 26 |
+
img = img / 255.0
|
| 27 |
+
|
| 28 |
+
# Predict
|
| 29 |
+
prediction = model.predict(img)[0][0]
|
| 30 |
+
|
| 31 |
+
# Result
|
| 32 |
+
if prediction < 0.5:
|
| 33 |
+
st.success("✅ Mask is Detected")
|
| 34 |
+
else:
|
| 35 |
+
st.error("🚫 Mask is NOT Detected")
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
tensorflow
|
| 3 |
+
keras
|
| 4 |
+
Pillow
|
| 5 |
+
numpy
|