Spaces:
Sleeping
Sleeping
Commit ·
af9e027
1
Parent(s): 37995d7
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
| 1 |
-
from transformers import AutoFeatureExtractor, YolosForObjectDetection
|
| 2 |
-
import gradio as gr
|
| 3 |
-
from PIL import Image
|
| 4 |
-
import torch
|
| 5 |
-
import matplotlib.pyplot as plt
|
| 6 |
import io
|
|
|
|
| 7 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
COLORS = [
|
|
@@ -88,6 +89,7 @@ image_out = gr.components.Image()
|
|
| 88 |
prob_threshold_slider = gr.components.Slider(
|
| 89 |
minimum=0, maximum=1.0, step=0.01, value=0.7, label="Probability Threshold"
|
| 90 |
)
|
|
|
|
| 91 |
classes_to_show = gr.components.Textbox(
|
| 92 |
placeholder="e.g. car, dog",
|
| 93 |
label="Classes to filter (leave empty to detect all classes)",
|
|
@@ -97,5 +99,5 @@ gr.Interface(fn=model_inference,
|
|
| 97 |
inputs=[image_in, prob_threshold_slider, classes_to_show],
|
| 98 |
outputs=image_out,
|
| 99 |
title=title,
|
| 100 |
-
examples=["
|
| 101 |
description=description).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import io
|
| 2 |
+
import torch
|
| 3 |
import numpy as np
|
| 4 |
+
import gradio as gr
|
| 5 |
+
import matplotlib.pyplot as plt
|
| 6 |
+
|
| 7 |
+
from transformers import AutoFeatureExtractor, YolosForObjectDetection
|
| 8 |
+
from PIL import Image
|
| 9 |
|
| 10 |
|
| 11 |
COLORS = [
|
|
|
|
| 89 |
prob_threshold_slider = gr.components.Slider(
|
| 90 |
minimum=0, maximum=1.0, step=0.01, value=0.7, label="Probability Threshold"
|
| 91 |
)
|
| 92 |
+
|
| 93 |
classes_to_show = gr.components.Textbox(
|
| 94 |
placeholder="e.g. car, dog",
|
| 95 |
label="Classes to filter (leave empty to detect all classes)",
|
|
|
|
| 99 |
inputs=[image_in, prob_threshold_slider, classes_to_show],
|
| 100 |
outputs=image_out,
|
| 101 |
title=title,
|
| 102 |
+
examples=["00_plane.jpg", "01_car.jpg"],
|
| 103 |
description=description).launch()
|