Spaces:
Sleeping
Sleeping
Commit
·
dd96198
1
Parent(s):
04d4702
Update app.py
Browse files
app.py
CHANGED
|
@@ -145,6 +145,9 @@ class LitYolo(LightningModule):
|
|
| 145 |
# gradio
|
| 146 |
with gr.Blocks() as demo:
|
| 147 |
|
|
|
|
|
|
|
|
|
|
| 148 |
# colors for the bboxes
|
| 149 |
cmap = plt.get_cmap("tab20b")
|
| 150 |
class_labels = config.PASCAL_CLASSES
|
|
@@ -204,7 +207,13 @@ with gr.Blocks() as demo:
|
|
| 204 |
sections.append(((upper_left_x,upper_left_y,lower_right_x,lower_right_y), class_labels[int(class_pred)]))
|
| 205 |
return (np.array(pr_input_img.squeeze(0).permute(1,2,0)),sections)
|
| 206 |
|
| 207 |
-
section_btn.click(yolo3_inference, img_input, img_output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
|
| 209 |
if __name__ == "__main__":
|
| 210 |
demo.launch()
|
|
|
|
| 145 |
# gradio
|
| 146 |
with gr.Blocks() as demo:
|
| 147 |
|
| 148 |
+
# example images
|
| 149 |
+
examples = ["example_images/000041.jpg","example_images/000042.jpg","example_images/000043.jpg","example_images/000044.jpg","example_images/000045.jpg"]
|
| 150 |
+
|
| 151 |
# colors for the bboxes
|
| 152 |
cmap = plt.get_cmap("tab20b")
|
| 153 |
class_labels = config.PASCAL_CLASSES
|
|
|
|
| 207 |
sections.append(((upper_left_x,upper_left_y,lower_right_x,lower_right_y), class_labels[int(class_pred)]))
|
| 208 |
return (np.array(pr_input_img.squeeze(0).permute(1,2,0)),sections)
|
| 209 |
|
| 210 |
+
section_btn.click(yolo3_inference, inputs=[img_input], outputs=[img_output])
|
| 211 |
+
|
| 212 |
+
gr.Markdown("## Some Examples")
|
| 213 |
+
gr.Examples(examples=examples,
|
| 214 |
+
inputs =img_input,
|
| 215 |
+
outputs=img_output,
|
| 216 |
+
fn=yolo3_inference, cache_examples=False)
|
| 217 |
|
| 218 |
if __name__ == "__main__":
|
| 219 |
demo.launch()
|