import gradio as gr def draw_mask(args): init_image = args.get("image") mask = args.get("mask") mask = mask.convert("RGB").resize((512, 512)) init_image = init_image.convert("RGB").resize((512, 512)) return mask gr.Interface( fn=draw_mask, inputs=gr.Image( source="upload", tool="sketch", elem_id="image_upload", type="pil", label="Upload", ).style(height=400), outputs=gr.Image(label="Result"), ).launch()