Spaces:
Running
Running
Commit
·
e018390
1
Parent(s):
7c8f933
adding app with CLIP image segmentation
Browse files
app.py
CHANGED
|
@@ -39,7 +39,6 @@ def detect_using_clip(image,prompts=[],threshould=0.4):
|
|
| 39 |
|
| 40 |
def visualize_images(image,predicted_images):
|
| 41 |
alpha = 0.7
|
| 42 |
-
# H,W = image.shape[:2]
|
| 43 |
image_resize = cv2.resize(image,(352,352))
|
| 44 |
resize_image_copy = image_resize.copy()
|
| 45 |
|
|
@@ -47,7 +46,6 @@ def visualize_images(image,predicted_images):
|
|
| 47 |
resize_image_copy = cv2.addWeighted(resize_image_copy,alpha,mask_image,1-alpha,10)
|
| 48 |
|
| 49 |
return cv2.convertScaleAbs(resize_image_copy, alpha=1.8, beta=15)
|
| 50 |
-
|
| 51 |
|
| 52 |
def shot(image, labels_text):
|
| 53 |
if "," in labels_text:
|
|
@@ -69,7 +67,7 @@ iface = gr.Interface(fn=shot,
|
|
| 69 |
["images/room.jpg","bed, table, plant, light, window,light"],
|
| 70 |
["images/image2.png","banner, building,door, sign,"],
|
| 71 |
["images/seats.jpg","door,table,chairs"],
|
| 72 |
-
["images/vegetables.jpg","carrot,radish,beans,potato,brnjal,basket"]
|
| 73 |
["images/room2.jpg","door,platns,dog,coffe table,mug,pillow,table lamp,carpet,pictures,door,clock"]
|
| 74 |
],
|
| 75 |
# allow_flagging=False,
|
|
|
|
| 39 |
|
| 40 |
def visualize_images(image,predicted_images):
|
| 41 |
alpha = 0.7
|
|
|
|
| 42 |
image_resize = cv2.resize(image,(352,352))
|
| 43 |
resize_image_copy = image_resize.copy()
|
| 44 |
|
|
|
|
| 46 |
resize_image_copy = cv2.addWeighted(resize_image_copy,alpha,mask_image,1-alpha,10)
|
| 47 |
|
| 48 |
return cv2.convertScaleAbs(resize_image_copy, alpha=1.8, beta=15)
|
|
|
|
| 49 |
|
| 50 |
def shot(image, labels_text):
|
| 51 |
if "," in labels_text:
|
|
|
|
| 67 |
["images/room.jpg","bed, table, plant, light, window,light"],
|
| 68 |
["images/image2.png","banner, building,door, sign,"],
|
| 69 |
["images/seats.jpg","door,table,chairs"],
|
| 70 |
+
["images/vegetables.jpg","carrot,radish,beans,potato,brnjal,basket"],
|
| 71 |
["images/room2.jpg","door,platns,dog,coffe table,mug,pillow,table lamp,carpet,pictures,door,clock"]
|
| 72 |
],
|
| 73 |
# allow_flagging=False,
|