Spaces:
Build error
Build error
Commit
·
3338041
1
Parent(s):
fa460fe
Update app.py
Browse files
app.py
CHANGED
|
@@ -85,7 +85,7 @@ reset_cls_test(predictor.model, classifier, num_classes)
|
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
-
def inference(img):
|
| 89 |
|
| 90 |
im = cv2.imread(img)
|
| 91 |
|
|
@@ -113,7 +113,7 @@ def inference(img):
|
|
| 113 |
"h": int(height),
|
| 114 |
}
|
| 115 |
)
|
| 116 |
-
if (predicted_label not in unique_object_dict):
|
| 117 |
object_list_str.append(
|
| 118 |
f"{predicted_label} - X:{int(x0)} Y: {int(y0)} Width: {int(width)} Height: {int(height)}"
|
| 119 |
)
|
|
@@ -145,6 +145,6 @@ with gr.Blocks() as demo:
|
|
| 145 |
output_desc = gr.Textbox(label="Description for using in ChatGPT", lines=5)
|
| 146 |
# outputjson = gr.JSON(label="Detected Objects")
|
| 147 |
|
| 148 |
-
btn_detic.click(fn=inference, inputs=inp, outputs=[outviz, output_desc])
|
| 149 |
|
| 150 |
demo.launch()
|
|
|
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
+
def inference(img,unique_only):
|
| 89 |
|
| 90 |
im = cv2.imread(img)
|
| 91 |
|
|
|
|
| 113 |
"h": int(height),
|
| 114 |
}
|
| 115 |
)
|
| 116 |
+
if ((not unique_only) or (unqiue_only and predicted_label not in unique_object_dict)):
|
| 117 |
object_list_str.append(
|
| 118 |
f"{predicted_label} - X:{int(x0)} Y: {int(y0)} Width: {int(width)} Height: {int(height)}"
|
| 119 |
)
|
|
|
|
| 145 |
output_desc = gr.Textbox(label="Description for using in ChatGPT", lines=5)
|
| 146 |
# outputjson = gr.JSON(label="Detected Objects")
|
| 147 |
|
| 148 |
+
btn_detic.click(fn=inference, inputs=[inp,"checkbox"], outputs=[outviz, output_desc])
|
| 149 |
|
| 150 |
demo.launch()
|