Spaces:
Sleeping
Sleeping
Commit
·
b2f9f4f
1
Parent(s):
1d61991
adding text box
Browse files
app.py
CHANGED
|
@@ -41,7 +41,7 @@ def detect_using_clip(image,prompts=[],threshould=0.4):
|
|
| 41 |
|
| 42 |
return model_detections
|
| 43 |
|
| 44 |
-
def
|
| 45 |
H,W = image.shape[:2]
|
| 46 |
image_copy = image.copy()
|
| 47 |
if prompt not in detections.keys():
|
|
@@ -63,10 +63,10 @@ def shot(image, labels_text,selected_categoty):
|
|
| 63 |
model_detections = detect_using_clip(image,prompts=prompts)
|
| 64 |
print("detections :",model_detections)
|
| 65 |
print("Ctegory ",selected_categoty)
|
| 66 |
-
return
|
| 67 |
|
| 68 |
iface = gr.Interface(fn=shot,
|
| 69 |
-
inputs = ["image","text",
|
| 70 |
outputs="image",
|
| 71 |
description="Add a picture and a list of labels separated by commas",
|
| 72 |
title="Zero-shot Image Classification with Prompt ",
|
|
|
|
| 41 |
|
| 42 |
return model_detections
|
| 43 |
|
| 44 |
+
def visualize_images(image,detections,prompt):
|
| 45 |
H,W = image.shape[:2]
|
| 46 |
image_copy = image.copy()
|
| 47 |
if prompt not in detections.keys():
|
|
|
|
| 63 |
model_detections = detect_using_clip(image,prompts=prompts)
|
| 64 |
print("detections :",model_detections)
|
| 65 |
print("Ctegory ",selected_categoty)
|
| 66 |
+
return visualize_images(image=image,detections=model_detections,prompt=selected_categoty)
|
| 67 |
|
| 68 |
iface = gr.Interface(fn=shot,
|
| 69 |
+
inputs = ["image","text","text"],
|
| 70 |
outputs="image",
|
| 71 |
description="Add a picture and a list of labels separated by commas",
|
| 72 |
title="Zero-shot Image Classification with Prompt ",
|