mrhan1993 / Fooocus-API

FastAPI powered API for Fooocus
GNU General Public License v3.0
589 stars 159 forks source link

Inpaint in Replicate's Docker #409

Open ChaerilM opened 4 days ago

ChaerilM commented 4 days ago

hi i was wondering on how to use inpaint using docker from replicate, this is what i sent to the api, i put ImagePrompt for cn_type1 and 2 since i want to use inpainting, so i set them to that which i assume to be the default. put the image in inpaint_input_image and mask in inpaint_mask_image. but it gave me result of fully generated ai image with no inpaint, so what did i do wrong here ?

$input = [
            'prompt' => $photo->prompt->text_prompt,
            // 'cn_img1' => $photo->photo,
            'cn_type1' => 'ImagePrompt', //$photo->prompt->template['cn_type1'] ?? 'FaceSwap',
            // 'cn_stop1' => $photo->prompt->template['cn_stop1'] ?? null,
            // 'cn_weight1' => $photo->prompt->template['cn_weight1'] ?? null,

            // 'cn_img2' => $photo->photo,
            'cn_type2' => 'ImagePrompt',
            // 'cn_stop2' => $photo->prompt->template['cn_stop2'] ?? null,
            // 'cn_weight2' => $photo->prompt->template['cn_weight2'] ?? null,

            'cn_type3' => 'ImagePrompt',
            'cn_type4' => 'ImagePrompt',
            'sharpness' => 2,
            'image_seed' => -1,
            'image_number' => $photo->prompt->template['image_number'],
            'guidance_scale' => 7,
            'refiner_switch' => 0.5,
            'negative_prompt' => $photo->prompt->template['negative_prompt'],
            'style_selections' => $photo->prompt->template['style_selections'],
            'uov_method' => $photo->prompt->template['uov_method'] ?? 'Disabled',
            'uov_upscale_value' => 0,
            'aspect_ratios_selection' => $photo->prompt->template['aspect_ratios_selection'] ?? '1024*1024',
            'performance_selection' => $photo->prompt->template['performance_selection'],
            'outpaint_selections' => '',
            'outpaint_distance_top' => 0,
            'outpaint_distance_left' => 0,
            'outpaint_distance_right' => 0,
            'outpaint_distance_bottom' => 0,
            'inpaint_additional_prompt' => '',
            'inpaint_input_image' => $photo->photo,
            'inpaint_mask_image' => asset('images/bw.png'),
            // 'base_model_name' => $photo->prompt->template['base_model_name'] ?? null,
            // 'loras' => $photo->prompt->template['loras'] ?? null,
        ];

thanks

mrhan1993 commented 2 days ago

Locally running containers or replicate hosted services? if running locally, which version

ChaerilM commented 2 days ago

locally, the latest i had used is '612fd74b69e6c030e88f6548848593a1aaabe16a09cb79e6d714718c15f37f47'
i was wrong, i use fooocus-api now without preset. so its should be 'fda927242b1db6affa1ece4f54c37f19b964666bf23b0d06ae2439067cd344a4'

ChaerilM commented 2 days ago

and i was wondering if there is a docker container with full fooocus-api's feature instead of watered down like replicate, where i could change model for example

mrhan1993 commented 1 day ago

and i was wondering if there is a docker container with full fooocus-api's feature instead of watered down like replicate, where i could change model for example

https://hub.docker.com/r/konieshadow/fooocus-api/tags it should be work well, In addition, you may need to hang the model outside the container

ChaerilM commented 1 day ago

my previous problem with model outside container is the auto download doesn't seems to be starting. thus leaving me trying to debug which .safetensors are missing. although i would want some auto remove output photo since i kept the result photo in S3. thus leaving them hanging outside container seems a good idea.