Beasto commited on
Commit
e89aa20
·
verified ·
1 Parent(s): e761590

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from PIL import Image,ImageDraw,ImageFont
2
+ import numpy as np
3
+ from ultralytics import YOLO
4
+ import streamlit as st
5
+
6
+ model = YOLO('MaskDetector.pt')
7
+ font_size = 40
8
+ img = st.file_uploader('Choose an Image')
9
+ font = ImageFont.truetype("arial.ttf", size=font_size)
10
+ arr = ['With mask','Without mask']
11
+
12
+ if img is not None:
13
+ img = Image.open(img).resize((640,640)).convert('RGB')
14
+ results = model(img)
15
+ st.image(img,'Input')
16
+ for result in results:
17
+ for j, mask in result.masks.data:
18
+ mask = mask.numpy()*255
19
+ st.image(mask,'Mask')