Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,10 +11,6 @@ model = YOLO('yolov8n.pt')
|
|
11 |
def main():
|
12 |
st.title("Object Detection - General Use")
|
13 |
st.write("This is a general use object detection space using YOLOv8")
|
14 |
-
st.header("Example Result")
|
15 |
-
# Display the example result image
|
16 |
-
example_image = Image.open("example.jpeg")
|
17 |
-
st.image(example_image, caption='Cars are picked out in green and the person is distinguished from the motorcycle', use_column_width=True)
|
18 |
st.header("Upload an Image")
|
19 |
# Upload image
|
20 |
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
@@ -41,9 +37,15 @@ def main():
|
|
41 |
|
42 |
# Convert the image array back to PIL Image
|
43 |
image = Image.fromarray(image_array)
|
44 |
-
|
45 |
# Display the image with detected objects
|
46 |
st.image(image, caption='Detected Objects')
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
if __name__ == "__main__":
|
49 |
main()
|
|
|
11 |
def main():
|
12 |
st.title("Object Detection - General Use")
|
13 |
st.write("This is a general use object detection space using YOLOv8")
|
|
|
|
|
|
|
|
|
14 |
st.header("Upload an Image")
|
15 |
# Upload image
|
16 |
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
|
|
37 |
|
38 |
# Convert the image array back to PIL Image
|
39 |
image = Image.fromarray(image_array)
|
40 |
+
|
41 |
# Display the image with detected objects
|
42 |
st.image(image, caption='Detected Objects')
|
43 |
+
|
44 |
+
if not uploaded_file:
|
45 |
+
# Display example image
|
46 |
+
st.header("Example Result")
|
47 |
+
example_image = Image.open("example.jpeg")
|
48 |
+
st.image(example_image, caption='Cars are picked out in green and the person is distinguished from the motorcycle', use_column_width=True)
|
49 |
|
50 |
if __name__ == "__main__":
|
51 |
main()
|