Spaces:
Sleeping
Sleeping
yizhangliu
commited on
Commit
•
6569d42
1
Parent(s):
52e09ec
Update app.py
Browse files
app.py
CHANGED
@@ -598,13 +598,10 @@ def run_anything_task(input_image, text_prompt, task_type, inpaint_prompt, box_t
|
|
598 |
|
599 |
logger.info(f"input_image==={input_image}")
|
600 |
if 'background' in input_image.keys():
|
601 |
-
input_image['image'] = input_image['background']
|
602 |
if len(input_image['layers']) > 0:
|
603 |
-
# input_image['mask'] = input_image['layers'][0] #brush_color
|
604 |
img_arr = np.array(input_image['layers'][0].convert("L"))
|
605 |
-
logger.info(f"img_arr==={img_arr.shape}, {img_arr[760][640]}, {img_arr[0][0]}")
|
606 |
img_arr = np.where(img_arr > 0, 1, img_arr)
|
607 |
-
# img_arr = 1 - img_arr
|
608 |
input_image['mask'] = Image.fromarray(255*img_arr.astype('uint8'))
|
609 |
|
610 |
if (task_type == 'Kosmos-2'):
|
|
|
598 |
|
599 |
logger.info(f"input_image==={input_image}")
|
600 |
if 'background' in input_image.keys():
|
601 |
+
input_image['image'] = input_image['background'].convert("RGB")
|
602 |
if len(input_image['layers']) > 0:
|
|
|
603 |
img_arr = np.array(input_image['layers'][0].convert("L"))
|
|
|
604 |
img_arr = np.where(img_arr > 0, 1, img_arr)
|
|
|
605 |
input_image['mask'] = Image.fromarray(255*img_arr.astype('uint8'))
|
606 |
|
607 |
if (task_type == 'Kosmos-2'):
|