Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -69,7 +69,9 @@ css = "h1 { text-align: center } .about { text-align: justify; padding-left: 10%
|
|
| 69 |
|
| 70 |
def segment_with_boxs(
|
| 71 |
image,
|
| 72 |
-
seg_image,
|
|
|
|
|
|
|
| 73 |
input_size=1024,
|
| 74 |
better_quality=False,
|
| 75 |
withContours=True,
|
|
@@ -160,15 +162,16 @@ def segment_with_boxs(
|
|
| 160 |
|
| 161 |
|
| 162 |
def segment_with_points(
|
| 163 |
-
image,
|
|
|
|
|
|
|
| 164 |
input_size=1024,
|
| 165 |
better_quality=False,
|
| 166 |
withContours=True,
|
| 167 |
use_retina=True,
|
| 168 |
mask_random_color=True,
|
| 169 |
):
|
| 170 |
-
|
| 171 |
-
|
| 172 |
print("Original Image : ", image.size)
|
| 173 |
|
| 174 |
input_size = int(input_size)
|
|
@@ -240,7 +243,7 @@ def segment_with_points(
|
|
| 240 |
|
| 241 |
|
| 242 |
def get_points_with_draw(image, cond_image, global_points, global_point_label, evt: gr.SelectData):
|
| 243 |
-
|
| 244 |
if len(global_points) == 0:
|
| 245 |
image = copy.deepcopy(cond_image)
|
| 246 |
x, y = evt.index[0], evt.index[1]
|
|
@@ -423,9 +426,6 @@ with gr.Blocks(css=css, title="Efficient SAM") as demo:
|
|
| 423 |
def clear():
|
| 424 |
return None, None, [], []
|
| 425 |
|
| 426 |
-
def clear_text():
|
| 427 |
-
return None, None, None
|
| 428 |
-
|
| 429 |
clear_btn_p.click(clear, outputs=[cond_img_p, segm_img_p, global_points, global_point_label])
|
| 430 |
clear_btn_b.click(clear, outputs=[cond_img_b, segm_img_b, global_points, global_point_label])
|
| 431 |
|
|
|
|
| 69 |
|
| 70 |
def segment_with_boxs(
|
| 71 |
image,
|
| 72 |
+
seg_image,
|
| 73 |
+
global_points,
|
| 74 |
+
global_point_label,
|
| 75 |
input_size=1024,
|
| 76 |
better_quality=False,
|
| 77 |
withContours=True,
|
|
|
|
| 162 |
|
| 163 |
|
| 164 |
def segment_with_points(
|
| 165 |
+
image,
|
| 166 |
+
global_points,
|
| 167 |
+
global_point_label,
|
| 168 |
input_size=1024,
|
| 169 |
better_quality=False,
|
| 170 |
withContours=True,
|
| 171 |
use_retina=True,
|
| 172 |
mask_random_color=True,
|
| 173 |
):
|
| 174 |
+
print("Starting getting points")
|
|
|
|
| 175 |
print("Original Image : ", image.size)
|
| 176 |
|
| 177 |
input_size = int(input_size)
|
|
|
|
| 243 |
|
| 244 |
|
| 245 |
def get_points_with_draw(image, cond_image, global_points, global_point_label, evt: gr.SelectData):
|
| 246 |
+
print("Starting functioning")
|
| 247 |
if len(global_points) == 0:
|
| 248 |
image = copy.deepcopy(cond_image)
|
| 249 |
x, y = evt.index[0], evt.index[1]
|
|
|
|
| 426 |
def clear():
|
| 427 |
return None, None, [], []
|
| 428 |
|
|
|
|
|
|
|
|
|
|
| 429 |
clear_btn_p.click(clear, outputs=[cond_img_p, segm_img_p, global_points, global_point_label])
|
| 430 |
clear_btn_b.click(clear, outputs=[cond_img_b, segm_img_b, global_points, global_point_label])
|
| 431 |
|