Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -10,12 +10,15 @@ torch.hub.download_url_to_file(
|
|
10 |
'https://s.wsj.net/public/resources/images/OB-EQ974_diwali_G_20091014112400.jpg', 'three.jpg')
|
11 |
|
12 |
|
13 |
-
def handle_classify(image
|
14 |
"""This function performs YOLOv8 object detection on the given image.
|
15 |
|
16 |
Args:
|
17 |
image (gr.inputs.Image, optional): Input image to detect objects on. Defaults to None.
|
18 |
"""
|
|
|
|
|
|
|
19 |
|
20 |
model_path = "racist2.0.pt"
|
21 |
model = YOLO(model_path)
|
@@ -33,11 +36,11 @@ def handle_classify(image: gr.inputs.Image = None):
|
|
33 |
|
34 |
|
35 |
inputs = [
|
36 |
-
gr.
|
37 |
]
|
38 |
|
39 |
|
40 |
-
outputs = gr.
|
41 |
|
42 |
title = "Racist model v2"
|
43 |
|
|
|
10 |
'https://s.wsj.net/public/resources/images/OB-EQ974_diwali_G_20091014112400.jpg', 'three.jpg')
|
11 |
|
12 |
|
13 |
+
def handle_classify(image=None):
|
14 |
"""This function performs YOLOv8 object detection on the given image.
|
15 |
|
16 |
Args:
|
17 |
image (gr.inputs.Image, optional): Input image to detect objects on. Defaults to None.
|
18 |
"""
|
19 |
+
|
20 |
+
if not image:
|
21 |
+
return "No image found"
|
22 |
|
23 |
model_path = "racist2.0.pt"
|
24 |
model = YOLO(model_path)
|
|
|
36 |
|
37 |
|
38 |
inputs = [
|
39 |
+
gr.Image(type="filepath", label="Input Image"),
|
40 |
]
|
41 |
|
42 |
|
43 |
+
outputs = gr.Textbox()
|
44 |
|
45 |
title = "Racist model v2"
|
46 |
|