Jongkook Choi commited on
Commit
dbd5944
·
1 Parent(s): f75c597

modified app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -5,9 +5,9 @@ from sahi.utils.cv import visualize_object_predictions, read_image
5
  from ultralyticsplus import YOLO
6
 
7
  # Images
8
- torch.hub.download_url_to_file('https://raw.githubusercontent.com/kadirnar/dethub/main/data/images/highway.jpg', 'highway.jpg')
9
- torch.hub.download_url_to_file('https://user-images.githubusercontent.com/34196005/142742872-1fefcc4d-d7e6-4c43-bbb7-6b5982f7e4ba.jpg', 'highway1.jpg')
10
- torch.hub.download_url_to_file('https://raw.githubusercontent.com/obss/sahi/main/tests/data/small-vehicles1.jpeg', 'small-vehicles1.jpeg')
11
 
12
  def yolov8_inference(
13
  image: gr.inputs.Image = None,
@@ -61,8 +61,9 @@ def yolov8_inference(
61
 
62
  inputs = [
63
  gr.inputs.Image(type="filepath", label="Input Image"),
64
- gr.inputs.Dropdown(["kadirnar/yolov8n-v8.0", "kadirnar/yolov8m-v8.0", "kadirnar/yolov8l-v8.0", "kadirnar/yolov8x-v8.0", "kadirnar/yolov8x6-v8.0"],
65
- default="kadirnar/yolov8m-v8.0", label="Model"),
 
66
  gr.inputs.Slider(minimum=320, maximum=1280, default=640, step=32, label="Image Size"),
67
  gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.25, step=0.05, label="Confidence Threshold"),
68
  gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold"),
@@ -71,7 +72,7 @@ inputs = [
71
  outputs = gr.outputs.Image(type="filepath", label="Output Image")
72
  title = "Ultralytics YOLOv8: State-of-the-Art YOLO Models"
73
 
74
- examples = [['highway.jpg', 'kadirnar/yolov8m-v8.0', 640, 0.25, 0.45], ['highway1.jpg', 'kadirnar/yolov8l-v8.0', 640, 0.25, 0.45], ['small-vehicles1.jpeg', 'kadirnar/yolov8x-v8.0', 1280, 0.25, 0.45]]
75
  demo_app = gr.Interface(
76
  fn=yolov8_inference,
77
  inputs=inputs,
@@ -81,4 +82,4 @@ demo_app = gr.Interface(
81
  cache_examples=True,
82
  theme='huggingface',
83
  )
84
- demo_app.launch(debug=True, enable_queue=True)
 
5
  from ultralyticsplus import YOLO
6
 
7
  # Images
8
+ torch.hub.download_url_to_file('https://raw.githubusercontent.com/jerryli27/AniSeg/master/samples/inputs/PL0bHKk6wuUGL_Qd34mf0XsQnyiDk2OeGR_032_T66-dT9j12E-0028.jpg', '0028.jpg')
9
+ # torch.hub.download_url_to_file('https://user-images.githubusercontent.com/34196005/142742872-1fefcc4d-d7e6-4c43-bbb7-6b5982f7e4ba.jpg', 'highway1.jpg')
10
+ # torch.hub.download_url_to_file('https://raw.githubusercontent.com/obss/sahi/main/tests/data/small-vehicles1.jpeg', 'small-vehicles1.jpeg')
11
 
12
  def yolov8_inference(
13
  image: gr.inputs.Image = None,
 
61
 
62
  inputs = [
63
  gr.inputs.Image(type="filepath", label="Input Image"),
64
+ # gr.inputs.Dropdown(["kadirnar/yolov8n-v8.0", "kadirnar/yolov8m-v8.0", "kadirnar/yolov8l-v8.0", "kadirnar/yolov8x-v8.0", "kadirnar/yolov8x6-v8.0"],
65
+ # default="kadirnar/yolov8m-v8.0", label="Model"),
66
+ gr.inputs.Dropdown(["https://huggingface.co/jongkook90/yolov8_comicbook/resolve/main/train/weights/best.pt"], default="https://huggingface.co/jongkook90/yolov8_comicbook/resolve/main/train/weights/best.pt", label="Model"),
67
  gr.inputs.Slider(minimum=320, maximum=1280, default=640, step=32, label="Image Size"),
68
  gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.25, step=0.05, label="Confidence Threshold"),
69
  gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold"),
 
72
  outputs = gr.outputs.Image(type="filepath", label="Output Image")
73
  title = "Ultralytics YOLOv8: State-of-the-Art YOLO Models"
74
 
75
+ examples = [['0028.jpg', 'https://huggingface.co/jongkook90/yolov8_comicbook/resolve/main/train/weights/best.pt', 640, 0.25, 0.45],]
76
  demo_app = gr.Interface(
77
  fn=yolov8_inference,
78
  inputs=inputs,
 
82
  cache_examples=True,
83
  theme='huggingface',
84
  )
85
+ demo_app.launch(debug=True, enable_queue=True)