File size: 623 Bytes
253e609
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from ultralytics import YOLO
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import streamlit as st

model=YOLO('yolov10n.pt')
st.title("YOLOv10 Object Detection")

uploaded_file=st.file_uploader("Chon mot tep anh? ", type=['jpg','jpeg','png'])
if uploaded_file is not None:
    image = Image.open(uploaded_file)
    st.image(image, caption="Anh dau vao", use_column_width=True)

    if st.button("Predict"):
        results=model.predict(source=np.array(image))
        result_images = results[0].plot()
        st.image(result_images, caption="Anh dau ra", use_column_width=True)