akhil5423 commited on
Commit
28014ed
·
verified ·
1 Parent(s): 70bfbe4

Remove hyperlinks from social media section, keep plain text only

Browse files
Files changed (1) hide show
  1. app.py +36 -77
app.py CHANGED
@@ -13,7 +13,6 @@ models = {
13
  "yolov10x": YOLO("jameslahm/yolov10x"),
14
  }
15
 
16
-
17
  @spaces.GPU(duration=30)
18
  def yolov10_inference(image, model_id, image_size, conf_threshold, iou_threshold):
19
  model = models[model_id]
@@ -26,7 +25,6 @@ def yolov10_inference(image, model_id, image_size, conf_threshold, iou_threshold
26
  annotated_image = results[0].plot()
27
  return Image.fromarray(annotated_image[..., ::-1])
28
 
29
-
30
  def app():
31
  with gr.Blocks():
32
  with gr.Row():
@@ -70,81 +68,6 @@ def app():
70
  with gr.Column():
71
  output_image = gr.Image(type="pil", label="Annotated Image")
72
 
73
- gr.Examples(
74
- examples=[
75
- ["dog.jpeg", "yolov10m", 640, 0.25, 0.45],
76
- ["huggingface.jpg", "yolov10m", 640, 0.25, 0.45],
77
- ["zidane.jpg", "yolov10m", 640, 0.25, 0.45],
78
- ],
79
- fn=yolov10_inference,
80
- inputs=[image, model_id, image_size, conf_threshold, iou_threshold],
81
- outputs=[output_image],
82
- cache_examples='lazy',
83
- )
84
-
85
- yolov10_infer.click(
86
- fn=yolov10_inference,
87
- inputs=[image, model_id, image_size, conf_threshold, iou_threshold],
88
- outputs=[output_image],
89
- )
90
-
91
-
92
- gradio_app = gr.Blocks()
93
- with gradio_app:
94
- gr.HTML(
95
- """
96
- <h1 style='text-align: center'>
97
- YOLOv10: Real-Time End-to-End Object Detection
98
- </h1>
99
- """)
100
- gr.HTML(
101
- """
102
- <h3 style='text-align: center'>
103
- Follow me for more!
104
- <a href='https://twitter.com/kadirnar_ai' target='_blank'>Twitter</a> | <a href='https://github.com/kadirnar' target='_blank'>Github</a> | <a href='https://www.linkedin.com/in/kadir-nar/' target='_blank'>Linkedin</a> | <a href='https://www.huggingface.co/kadirnar/' target='_blank'>HuggingFace</a>
105
- </h3>
106
- """)
107
- with gr.Row():
108
- with gr.Column():
109
- image = gr.Image(type="pil", label="Image")
110
- model_id = gr.Dropdown(
111
- label="Model",
112
- choices=[
113
- "yolov10n",
114
- "yolov10s",
115
- "yolov10m",
116
- "yolov10b",
117
- "yolov10l",
118
- "yolov10x",
119
- ],
120
- value="yolov10m",
121
- )
122
- image_size = gr.Slider(
123
- label="Image Size",
124
- minimum=320,
125
- maximum=1280,
126
- step=32,
127
- value=640,
128
- )
129
- conf_threshold = gr.Slider(
130
- label="Confidence Threshold",
131
- minimum=0.0,
132
- maximum=1.0,
133
- step=0.05,
134
- value=0.25,
135
- )
136
- iou_threshold = gr.Slider(
137
- label="IoU Threshold",
138
- minimum=0.0,
139
- maximum=1.0,
140
- step=0.05,
141
- value=0.45,
142
- )
143
- yolov10_infer = gr.Button(value="Detect Objects")
144
-
145
- with gr.Column():
146
- output_image = gr.Image(type="pil", label="Annotated Image")
147
-
148
  gr.Examples(
149
  examples=[
150
  ["dog.jpeg", "yolov10m", 640, 0.25, 0.45],
@@ -163,5 +86,41 @@ with gradio_app:
163
  outputs=[output_image],
164
  )
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  if __name__ == "__main__":
167
  gradio_app.launch()
 
13
  "yolov10x": YOLO("jameslahm/yolov10x"),
14
  }
15
 
 
16
  @spaces.GPU(duration=30)
17
  def yolov10_inference(image, model_id, image_size, conf_threshold, iou_threshold):
18
  model = models[model_id]
 
25
  annotated_image = results[0].plot()
26
  return Image.fromarray(annotated_image[..., ::-1])
27
 
 
28
  def app():
29
  with gr.Blocks():
30
  with gr.Row():
 
68
  with gr.Column():
69
  output_image = gr.Image(type="pil", label="Annotated Image")
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  gr.Examples(
72
  examples=[
73
  ["dog.jpeg", "yolov10m", 640, 0.25, 0.45],
 
86
  outputs=[output_image],
87
  )
88
 
89
+ gradio_app = gr.Blocks()
90
+
91
+ with gradio_app:
92
+ with gr.Row():
93
+ with gr.Column():
94
+ gr.HTML(
95
+ """
96
+ <h1 style='text-align: center'>
97
+ YOLOv10: Real-Time End-to-End Object Detection
98
+ </h1>
99
+ """
100
+ )
101
+ gr.HTML(
102
+ """
103
+ <h3 style='text-align: center'>
104
+ <a href='https://arxiv.org/abs/2405.14458' target='_blank'>arXiv</a> | <a href='https://github.com/THU-MIG/yolov10' target='_blank'>github</a>
105
+ </h3>
106
+ """
107
+ )
108
+ gr.HTML(
109
+ """
110
+ <h3 style='text-align: center'>
111
+ Follow me for more!
112
+ </h3>
113
+ """
114
+ )
115
+ gr.HTML(
116
+ """
117
+ <div style='text-align: center;'>
118
+ Twitter | Github | Linkedin | HuggingFace
119
+ </div>
120
+ """
121
+ )
122
+
123
+ app()
124
+
125
  if __name__ == "__main__":
126
  gradio_app.launch()