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)