ducngg commited on
Commit
10183ac
1 Parent(s): 9313dfd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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: gr.inputs.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
  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.inputs.Image(type="filepath", label="Input Image"),
37
  ]
38
 
39
 
40
- outputs = gr.outputs.Text()
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