Anon4445 commited on
Commit
4bb2e9b
1 Parent(s): b2853c9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from ultralytics import YOLO
3
+ from PIL import Image
4
+ model= YOLO ("yolov8n-seg.pt")
5
+ st.title("image segmentation")
6
+ up= st.file_uploader("upload an image", type= ["jpg","png", "jpeg"])
7
+ if st.button("detect"):
8
+ image= Image.open(up).convert('RGB')
9
+ result= model(image)
10
+ output= result[0].plot()
11
+ col1, col2= st.columns(2)
12
+ with col1:
13
+ st.image(image,use_column_width= True)
14
+ with col2:
15
+
16
+ st.image(output,use_column_width= True)