sovitrath commited on
Commit
c6b7813
1 Parent(s): 4bc5f81

App components update

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -26,7 +26,7 @@ for i, url in enumerate(file_urls):
26
  model = YOLO('best.pt')
27
  path = [['image_0.jpg'], ['image_1.jpg']]
28
 
29
- def show_preds(image_path):
30
  image = cv2.imread(image_path)
31
  outputs = model.predict(source=image_path, return_outputs=True)
32
  for image_id, result in enumerate(outputs):
@@ -43,14 +43,21 @@ def show_preds(image_path):
43
  )
44
  return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
45
 
46
- gr_interface = gr.Interface(
 
 
 
 
 
 
 
 
47
  fn=show_preds,
48
- inputs=gr.inputs.Image(type="filepath", label="Input Image"),
49
- outputs=gr.outputs.Image(type="numpy", label="Output Image"),
50
  title="Pothole detector",
51
  examples=path,
52
  cache_examples=False,
53
  # live=True,
54
  )
55
-
56
- gr_interface.launch(debug=True, enable_queue=True)
 
26
  model = YOLO('best.pt')
27
  path = [['image_0.jpg'], ['image_1.jpg']]
28
 
29
+ def show_preds(image_path, video_path=None):
30
  image = cv2.imread(image_path)
31
  outputs = model.predict(source=image_path, return_outputs=True)
32
  for image_id, result in enumerate(outputs):
 
43
  )
44
  return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
45
 
46
+ inputs_image = [
47
+ gr.components.Image(type="filepath", label="Input Image"),
48
+ # gr.components.Video(type="filepath", label="Input Video", optional=True),
49
+
50
+ ]
51
+ outputs_image = [
52
+ gr.components.Image(type="numpy", label="Output Image"),
53
+ ]
54
+ interface = gr.Interface(
55
  fn=show_preds,
56
+ inputs=inputs_image,
57
+ outputs=outputs_image,
58
  title="Pothole detector",
59
  examples=path,
60
  cache_examples=False,
61
  # live=True,
62
  )
63
+ interface.launch(debug=True, enable_queue=True)