scfive commited on
Commit
0468171
·
verified ·
1 Parent(s): 521e7d2

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +27 -0
  2. best.pt +3 -0
  3. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from ultralytics import YOLO
3
+ from PIL import Image
4
+ import numpy as np
5
+ import os
6
+
7
+ # Load the model
8
+ model_path = "./models/best.pt"
9
+ model = YOLO(model_path)
10
+
11
+ # Streamlit app
12
+ st.title("YOLOv11 Object Detection")
13
+ st.write("Upload an image and let the model detect objects.")
14
+
15
+ uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "png", "jpeg"])
16
+ if uploaded_file:
17
+ # Read and display the image
18
+ image = Image.open(uploaded_file)
19
+ st.image(image, caption="Uploaded Image", use_column_width=True)
20
+
21
+ # Perform prediction
22
+ with st.spinner("Processing..."):
23
+ results = model.predict(np.array(image))
24
+
25
+ # Display results
26
+ st.write("Detection Results:")
27
+ st.image(results[0].plot(), caption="Detections", use_column_width=True)
best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e40b1f30fd772a3e9d2045552f5d47e2820d397e8793d8185d474b416469601c
3
+ size 19178067
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ streamlit
2
+ ultralytics
3
+ Pillow
4
+ numpy