This code is which can generate mask image.
At the first, I should edit image for generating mask image.
Please check this URL.
https://huggingface.co/spaces/stevhliu/inpaint-mask-maker/blob/main/app.py
import gradio as gr
import imageio
def dummy(img):
imageio.imwrite("output_image.png", img["mask"])
return img["image"], img["mask"]
with gr.Blocks() as demo:
with gr.Row():
img = gr.Image(tool="sketch", label="base image", show_label=True)
img1 = gr.Image()
img2 = gr.Image(label="mask image", show_label=True)
btn = gr.Button()
btn.click(dummy, img, [img1, img2])
demo.launch(debug=True)
After run, error is generated. error is below as:
Traceback (most recent call last):
File "D:eye_image_modifyinpainting_mask.py", line 10, in <module>
img = gr.Image(tool="sketch", label="base image", show_label=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersYunPei ZhangAppDataLocalProgramsPythonPython312Libsite-packagesgradiocomponent_meta.py", line 160, in wrapper
return fn(self, **kwargs)
^^^^^^^^^^^^^^^^^^
TypeError: Image.__init__() got an unexpected keyword argument 'tool'
I am using Python 3.12.1 and I have already installed python libraries
If someone know this error, Please help me.
Thanks
I want to run this attached code
New contributor
YunPei Zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.