Using tool='color-sketch' in gr.Image for masks

Hello Community,

I wanted to be able to use different colors for generating a mask in an image because some of my images had pretty dark background and a black mask was hard to draw. As I set the tool as ‘color-sketch’, it threw the following error:

TypeError: ‘Image’ object is not subscriptable

It occurs at the following line of my code below:
image = dict[‘image’].convert(“RGB”).resize((width, height))

Can anyone explain why? And perhaps know how to fix it? I am back to ‘tool=sketch’ but it would be lovely to draw different color masks!

Thanks!

=============
def inpaint(dict, prompt, n_prompt, width, height, option, inference_steps, guidance_scale):
scheduler(option)
image = dict[‘image’].convert(“RGB”).resize((width, height))
mask_image = dict[‘mask’].convert(“RGB”).resize((width, height))
output = pipe(prompt=prompt,
negative_prompt=n_prompt,
image=image,
mask_image=mask_image,
width=width,
height=height,
num_inference_steps=int(inference_steps),
guidance_scale=int(guidance_scale),
num_images_per_prompt=1,
).images
return(output[0])