Spaces:
Runtime error
Runtime error
File size: 489 Bytes
4bb2e9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import streamlit as st
from ultralytics import YOLO
from PIL import Image
model= YOLO ("yolov8n-seg.pt")
st.title("image segmentation")
up= st.file_uploader("upload an image", type= ["jpg","png", "jpeg"])
if st.button("detect"):
image= Image.open(up).convert('RGB')
result= model(image)
output= result[0].plot()
col1, col2= st.columns(2)
with col1:
st.image(image,use_column_width= True)
with col2:
st.image(output,use_column_width= True)
|