File size: 456 Bytes
0271620
cdc1299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from PIL import Image,ImageDraw,ImageFont
import numpy as np
from ultralytics import YOLO
import streamlit as st

model = YOLO('HumanSegmentation.pt')
img = st.file_uploader('Choose an Image')

if img is not None:
    img = Image.open(img).resize((640,640)).convert('RGB')
    results = model(img)
    st.image(img,'Input')
    for result in results:
        for mask in result.masks.data:
            mask = mask.numpy()
            st.image(mask,'Mask')