Update app.py
Browse filesReverting to get it working.
app.py
CHANGED
@@ -81,8 +81,9 @@ def detect_objects(model_name,url_input,image_input,threshold):
|
|
81 |
#Visualize prediction
|
82 |
viz_img = visualize_prediction(image, processed_outputs, threshold, model.config.id2label)
|
83 |
|
84 |
-
return [viz_img, processed_outputs]
|
85 |
-
|
|
|
86 |
|
87 |
def set_example_image(example: list) -> dict:
|
88 |
return gr.Image.update(value=example[0])
|
@@ -154,11 +155,11 @@ with demo:
|
|
154 |
|
155 |
# url_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=[img_output_from_url, output_text1],queue=True)
|
156 |
# img_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=[img_output_from_upload, output_text2],queue=True)
|
157 |
-
url_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=[img_output_from_url, _],queue=True)
|
158 |
-
img_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=[img_output_from_upload, _],queue=True)
|
159 |
|
160 |
-
|
161 |
-
|
162 |
|
163 |
|
164 |
example_images.click(fn=set_example_image,inputs=[example_images],outputs=[img_input])
|
|
|
81 |
#Visualize prediction
|
82 |
viz_img = visualize_prediction(image, processed_outputs, threshold, model.config.id2label)
|
83 |
|
84 |
+
# return [viz_img, processed_outputs]
|
85 |
+
print(type(viz_img))
|
86 |
+
return viz_img
|
87 |
|
88 |
def set_example_image(example: list) -> dict:
|
89 |
return gr.Image.update(value=example[0])
|
|
|
155 |
|
156 |
# url_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=[img_output_from_url, output_text1],queue=True)
|
157 |
# img_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=[img_output_from_upload, output_text2],queue=True)
|
158 |
+
# url_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=[img_output_from_url, _],queue=True)
|
159 |
+
# img_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=[img_output_from_upload, _],queue=True)
|
160 |
|
161 |
+
url_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=img_output_from_url,queue=True)
|
162 |
+
img_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=img_output_from_upload,queue=True)
|
163 |
|
164 |
|
165 |
example_images.click(fn=set_example_image,inputs=[example_images],outputs=[img_input])
|