Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ def fig2img(fig):
|
|
35 |
return img
|
36 |
|
37 |
|
38 |
-
def visualize_prediction(pil_img, output_dict, threshold=0.
|
39 |
keep = output_dict["scores"] > threshold
|
40 |
boxes = output_dict["boxes"][keep].tolist()
|
41 |
scores = output_dict["scores"][keep].tolist()
|
@@ -121,7 +121,7 @@ with demo:
|
|
121 |
with gr.TabItem('Image URL'):
|
122 |
with gr.Row():
|
123 |
url_input = gr.Textbox(lines=2,label='Enter valid image URL here..')
|
124 |
-
img_output_from_url = gr.Image(shape=(
|
125 |
|
126 |
with gr.Row():
|
127 |
example_url = gr.Dataset(components=[url_input],samples=[[str(url)] for url in urls])
|
@@ -135,7 +135,7 @@ with demo:
|
|
135 |
|
136 |
with gr.Row():
|
137 |
example_images = gr.Dataset(components=[img_input],
|
138 |
-
samples=[[path.as_posix()]
|
139 |
for path in sorted(pathlib.Path('images').rglob('*.JPG'))])
|
140 |
|
141 |
img_but = gr.Button('Detect')
|
|
|
35 |
return img
|
36 |
|
37 |
|
38 |
+
def visualize_prediction(pil_img, output_dict, threshold=0.5, id2label=None):
|
39 |
keep = output_dict["scores"] > threshold
|
40 |
boxes = output_dict["boxes"][keep].tolist()
|
41 |
scores = output_dict["scores"][keep].tolist()
|
|
|
121 |
with gr.TabItem('Image URL'):
|
122 |
with gr.Row():
|
123 |
url_input = gr.Textbox(lines=2,label='Enter valid image URL here..')
|
124 |
+
img_output_from_url = gr.Image(shape=(750,750))
|
125 |
|
126 |
with gr.Row():
|
127 |
example_url = gr.Dataset(components=[url_input],samples=[[str(url)] for url in urls])
|
|
|
135 |
|
136 |
with gr.Row():
|
137 |
example_images = gr.Dataset(components=[img_input],
|
138 |
+
samples=[[path.as_posix("images")]
|
139 |
for path in sorted(pathlib.Path('images').rglob('*.JPG'))])
|
140 |
|
141 |
img_but = gr.Button('Detect')
|