Skip to content

Commit 0b9af21

Browse files
committed
Merge for Fooocus v2.1.822
1 parent 20cbedc commit 0b9af21

9 files changed

+282
-146
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
FastAPI powered API for [Fooocus](https://github.com/lllyasviel/Fooocus)
66

7-
Currently loaded Fooocus version: 2.1.820
7+
Currently loaded Fooocus version: 2.1.822
88

99
### Run with Replicate
1010
Now you can use Fooocus-API by Replicate, the model is in [konieshadow/fooocus-api](https://replicate.com/konieshadow/fooocus-api).

docs/openapi.json

+74-30
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,6 @@
707707
"description": "Canny High Threshold",
708708
"default": 128
709709
},
710-
"inpaint_engine": {
711-
"type": "string",
712-
"title": "Inpaint Engine",
713-
"description": "Inpaint Engine",
714-
"default": "v1"
715-
},
716710
"freeu_enabled": {
717711
"type": "boolean",
718712
"title": "Freeu Enabled",
@@ -742,6 +736,40 @@
742736
"title": "Freeu S2",
743737
"description": "FreeU B4",
744738
"default": 0.95
739+
},
740+
"debugging_inpaint_preprocessor": {
741+
"type": "boolean",
742+
"title": "Debugging Inpaint Preprocessor",
743+
"description": "Debug Inpaint Preprocessing",
744+
"default": false
745+
},
746+
"inpaint_disable_initial_latent": {
747+
"type": "boolean",
748+
"title": "Inpaint Disable Initial Latent",
749+
"description": "Disable initial latent in inpaint",
750+
"default": false
751+
},
752+
"inpaint_engine": {
753+
"type": "string",
754+
"title": "Inpaint Engine",
755+
"description": "Inpaint Engine",
756+
"default": "v1"
757+
},
758+
"inpaint_strength": {
759+
"type": "number",
760+
"maximum": 1,
761+
"minimum": 0,
762+
"title": "Inpaint Strength",
763+
"description": "Inpaint Denoising Strength",
764+
"default": 1
765+
},
766+
"inpaint_respective_field": {
767+
"type": "number",
768+
"maximum": 1,
769+
"minimum": 0,
770+
"title": "Inpaint Respective Field",
771+
"description": "Inpaint Respective Field",
772+
"default": 1
745773
}
746774
},
747775
"type": "object",
@@ -874,6 +902,18 @@
874902
"title": "Input Mask",
875903
"description": "Inpaint or outpaint mask"
876904
},
905+
"inpaint_additional_prompt": {
906+
"anyOf": [
907+
{
908+
"type": "string"
909+
},
910+
{
911+
"type": "null"
912+
}
913+
],
914+
"title": "Inpaint Additional Prompt",
915+
"description": "Describe what you want to inpaint"
916+
},
877917
"outpaint_selections": {
878918
"items": {
879919
"type": "string"
@@ -902,7 +942,8 @@
902942
"description": "Fooocus style selections, seperated by comma",
903943
"default": [
904944
"Fooocus V2",
905-
"Fooocus Cinematic"
945+
"Fooocus Enhance",
946+
"Fooocus Sharp"
906947
]
907948
},
908949
"performance_selection": {
@@ -944,25 +985,25 @@
944985
"maximum": 30,
945986
"minimum": 1,
946987
"title": "Guidance Scale",
947-
"default": 7
988+
"default": 4
948989
},
949990
"base_model_name": {
950991
"type": "string",
951992
"title": "Base Model Name",
952-
"default": "sd_xl_base_1.0_0.9vae.safetensors"
993+
"default": "juggernautXL_version6Rundiffusion.safetensors"
953994
},
954995
"refiner_model_name": {
955996
"type": "string",
956997
"title": "Refiner Model Name",
957-
"default": "sd_xl_refiner_1.0_0.9vae.safetensors"
998+
"default": "None"
958999
},
9591000
"refiner_switch": {
9601001
"type": "number",
9611002
"maximum": 1,
9621003
"minimum": 0.1,
9631004
"title": "Refiner Switch",
9641005
"description": "Refiner Switch At",
965-
"default": 0.667
1006+
"default": 0.5
9661007
},
9671008
"loras": {
9681009
"anyOf": [
@@ -975,7 +1016,7 @@
9751016
],
9761017
"title": "Loras",
9771018
"description": "Lora config in JSON. Format as [{\"model_name\": \"sd_xl_offset_example-lora_1.0.safetensors\", \"weight\": 0.5}]",
978-
"default": "[{\"model_name\":\"sd_xl_offset_example-lora_1.0.safetensors\",\"weight\":0.5}]"
1019+
"default": "[{\"model_name\":\"sd_xl_offset_example-lora_1.0.safetensors\",\"weight\":0.1}]"
9791020
},
9801021
"advanced_params": {
9811022
"anyOf": [
@@ -1201,7 +1242,8 @@
12011242
"description": "Fooocus style selections, seperated by comma",
12021243
"default": [
12031244
"Fooocus V2",
1204-
"Fooocus Cinematic"
1245+
"Fooocus Enhance",
1246+
"Fooocus Sharp"
12051247
]
12061248
},
12071249
"performance_selection": {
@@ -1243,25 +1285,25 @@
12431285
"maximum": 30,
12441286
"minimum": 1,
12451287
"title": "Guidance Scale",
1246-
"default": 7
1288+
"default": 4
12471289
},
12481290
"base_model_name": {
12491291
"type": "string",
12501292
"title": "Base Model Name",
1251-
"default": "sd_xl_base_1.0_0.9vae.safetensors"
1293+
"default": "juggernautXL_version6Rundiffusion.safetensors"
12521294
},
12531295
"refiner_model_name": {
12541296
"type": "string",
12551297
"title": "Refiner Model Name",
1256-
"default": "sd_xl_refiner_1.0_0.9vae.safetensors"
1298+
"default": "None"
12571299
},
12581300
"refiner_switch": {
12591301
"type": "number",
12601302
"maximum": 1,
12611303
"minimum": 0.1,
12621304
"title": "Refiner Switch",
12631305
"description": "Refiner Switch At",
1264-
"default": 0.667
1306+
"default": 0.5
12651307
},
12661308
"loras": {
12671309
"anyOf": [
@@ -1274,7 +1316,7 @@
12741316
],
12751317
"title": "Loras",
12761318
"description": "Lora config in JSON. Format as [{\"model_name\": \"sd_xl_offset_example-lora_1.0.safetensors\", \"weight\": 0.5}]",
1277-
"default": "[{\"model_name\":\"sd_xl_offset_example-lora_1.0.safetensors\",\"weight\":0.5}]"
1319+
"default": "[{\"model_name\":\"sd_xl_offset_example-lora_1.0.safetensors\",\"weight\":0.1}]"
12781320
},
12791321
"advanced_params": {
12801322
"anyOf": [
@@ -1334,7 +1376,8 @@
13341376
"description": "Fooocus style selections, seperated by comma",
13351377
"default": [
13361378
"Fooocus V2",
1337-
"Fooocus Cinematic"
1379+
"Fooocus Enhance",
1380+
"Fooocus Sharp"
13381381
]
13391382
},
13401383
"performance_selection": {
@@ -1376,25 +1419,25 @@
13761419
"maximum": 30,
13771420
"minimum": 1,
13781421
"title": "Guidance Scale",
1379-
"default": 7
1422+
"default": 4
13801423
},
13811424
"base_model_name": {
13821425
"type": "string",
13831426
"title": "Base Model Name",
1384-
"default": "sd_xl_base_1.0_0.9vae.safetensors"
1427+
"default": "juggernautXL_version6Rundiffusion.safetensors"
13851428
},
13861429
"refiner_model_name": {
13871430
"type": "string",
13881431
"title": "Refiner Model Name",
1389-
"default": "sd_xl_refiner_1.0_0.9vae.safetensors"
1432+
"default": "None"
13901433
},
13911434
"refiner_switch": {
13921435
"type": "number",
13931436
"maximum": 1,
13941437
"minimum": 0.1,
13951438
"title": "Refiner Switch",
13961439
"description": "Refiner Switch At",
1397-
"default": 0.667
1440+
"default": 0.5
13981441
},
13991442
"loras": {
14001443
"anyOf": [
@@ -1407,7 +1450,7 @@
14071450
],
14081451
"title": "Loras",
14091452
"description": "Lora config in JSON. Format as [{\"model_name\": \"sd_xl_offset_example-lora_1.0.safetensors\", \"weight\": 0.5}]",
1410-
"default": "[{\"model_name\":\"sd_xl_offset_example-lora_1.0.safetensors\",\"weight\":0.5}]"
1453+
"default": "[{\"model_name\":\"sd_xl_offset_example-lora_1.0.safetensors\",\"weight\":0.1}]"
14111454
},
14121455
"advanced_params": {
14131456
"anyOf": [
@@ -1616,7 +1659,8 @@
16161659
"title": "Style Selections",
16171660
"default": [
16181661
"Fooocus V2",
1619-
"Fooocus Cinematic"
1662+
"Fooocus Enhance",
1663+
"Fooocus Sharp"
16201664
]
16211665
},
16221666
"performance_selection": {
@@ -1658,25 +1702,25 @@
16581702
"maximum": 30,
16591703
"minimum": 1,
16601704
"title": "Guidance Scale",
1661-
"default": 7
1705+
"default": 4
16621706
},
16631707
"base_model_name": {
16641708
"type": "string",
16651709
"title": "Base Model Name",
1666-
"default": "sd_xl_base_1.0_0.9vae.safetensors"
1710+
"default": "juggernautXL_version6Rundiffusion.safetensors"
16671711
},
16681712
"refiner_model_name": {
16691713
"type": "string",
16701714
"title": "Refiner Model Name",
1671-
"default": "sd_xl_refiner_1.0_0.9vae.safetensors"
1715+
"default": "None"
16721716
},
16731717
"refiner_switch": {
16741718
"type": "number",
16751719
"maximum": 1,
16761720
"minimum": 0.1,
16771721
"title": "Refiner Switch",
16781722
"description": "Refiner Switch At",
1679-
"default": 0.667
1723+
"default": 0.5
16801724
},
16811725
"loras": {
16821726
"items": {
@@ -1687,7 +1731,7 @@
16871731
"default": [
16881732
{
16891733
"model_name": "sd_xl_offset_example-lora_1.0.safetensors",
1690-
"weight": 0.5
1734+
"weight": 0.1
16911735
}
16921736
]
16931737
},

fooocus_api_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '0.3.16'
1+
version = '0.3.17'

fooocusapi/api_utils.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def req_to_params(req: Text2ImgRequest) -> ImageGenerationParams:
5858
refiner_model_name = 'None'
5959

6060
inpaint_input_image = None
61+
inpaint_additional_prompt = None
6162
if isinstance(req, ImgInpaintOrOutpaintRequest):
63+
inpaint_additional_prompt = req.inpaint_additional_prompt
6264
input_image = read_input_image(req.input_image)
6365
input_mask = None
6466
if req.input_mask is not None:
@@ -96,12 +98,16 @@ def req_to_params(req: Text2ImgRequest) -> ImageGenerationParams:
9698
print(f"[Warning] Wrong inpaint_engine input: {adp.inpaint_engine}, using default")
9799
adp.inpaint_engine = flags.default_inpaint_engine_version
98100

99-
advanced_params = [adp.disable_preview, adp.adm_scaler_positive, adp.adm_scaler_negative, adp.adm_scaler_end, adp.adaptive_cfg, adp.sampler_name,
100-
adp.scheduler_name, False, adp.overwrite_step, adp.overwrite_switch, adp.overwrite_width, adp.overwrite_height,
101-
adp.overwrite_vary_strength, adp.overwrite_upscale_strength,
102-
adp.mixing_image_prompt_and_vary_upscale, adp.mixing_image_prompt_and_inpaint,
103-
adp.debugging_cn_preprocessor, adp.skipping_cn_preprocessor, adp.controlnet_softness, adp.canny_low_threshold, adp.canny_high_threshold, adp.inpaint_engine,
104-
adp.refiner_swap_method, adp.freeu_enabled, adp.freeu_b1, adp.freeu_b2, adp.freeu_s1, adp.freeu_s2]
101+
advanced_params = [
102+
adp.disable_preview, adp.adm_scaler_positive, adp.adm_scaler_negative, adp.adm_scaler_end, adp.adaptive_cfg, adp.sampler_name, \
103+
adp.scheduler_name, False, adp.overwrite_step, adp.overwrite_switch, adp.overwrite_width, adp.overwrite_height, \
104+
adp.overwrite_vary_strength, adp.overwrite_upscale_strength, \
105+
adp.mixing_image_prompt_and_vary_upscale, adp.mixing_image_prompt_and_inpaint, \
106+
adp.debugging_cn_preprocessor, adp.skipping_cn_preprocessor, adp.controlnet_softness, adp.canny_low_threshold, adp.canny_high_threshold, \
107+
adp.refiner_swap_method, \
108+
adp.freeu_enabled, adp.freeu_b1, adp.freeu_b2, adp.freeu_s1, adp.freeu_s2, \
109+
adp.debugging_inpaint_preprocessor, adp.inpaint_disable_initial_latent, adp.inpaint_engine, adp.inpaint_strength, adp.inpaint_respective_field
110+
]
105111

106112
return ImageGenerationParams(prompt=prompt,
107113
negative_prompt=negative_prompt,
@@ -120,6 +126,7 @@ def req_to_params(req: Text2ImgRequest) -> ImageGenerationParams:
120126
uov_method=uov_method,
121127
outpaint_selections=outpaint_selections,
122128
inpaint_input_image=inpaint_input_image,
129+
inpaint_additional_prompt=inpaint_additional_prompt,
123130
image_prompts=image_prompts,
124131
advanced_params=advanced_params,
125132
)

fooocusapi/models.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,16 @@ class AdvancedParams(BaseModel):
8585
controlnet_softness: float = Field(0.25, description="Softness of ControlNet", ge=0.0, le=1.0)
8686
canny_low_threshold: int = Field(64, description="Canny Low Threshold", ge=1, le=255)
8787
canny_high_threshold: int = Field(128, description="Canny High Threshold", ge=1, le=255)
88-
inpaint_engine: str = Field('v1', description="Inpaint Engine")
8988
freeu_enabled: bool = Field(False, description="FreeU enabled")
9089
freeu_b1: float = Field(1.01, description="FreeU B1")
9190
freeu_b2: float = Field(1.02, description="FreeU B2")
9291
freeu_s1: float = Field(0.99, description="FreeU B3")
9392
freeu_s2: float = Field(0.95, description="FreeU B4")
93+
debugging_inpaint_preprocessor: bool = Field(False, description="Debug Inpaint Preprocessing")
94+
inpaint_disable_initial_latent: bool = Field(False, description="Disable initial latent in inpaint")
95+
inpaint_engine: str = Field('v1', description="Inpaint Engine")
96+
inpaint_strength: float = Field(1.0, description="Inpaint Denoising Strength", ge=0.0, le=1.0)
97+
inpaint_respective_field: float = Field(1.0, description="Inpaint Respective Field", ge=0.0, le=1.0)
9498

9599

96100
class Text2ImgRequest(BaseModel):
@@ -172,12 +176,14 @@ def as_form(cls, input_image: UploadFile = Form(description="Init image for upsa
172176
class ImgInpaintOrOutpaintRequest(Text2ImgRequest):
173177
input_image: UploadFile
174178
input_mask: UploadFile | None
179+
inpaint_additional_prompt: str | None
175180
outpaint_selections: List[OutpaintExpansion]
176181

177182
@classmethod
178183
def as_form(cls, input_image: UploadFile = Form(description="Init image for inpaint or outpaint"),
179184
input_mask: UploadFile = Form(
180185
File(None), description="Inpaint or outpaint mask"),
186+
inpaint_additional_prompt: str | None = Form(None, description="Describe what you want to inpaint"),
181187
outpaint_selections: List[str] = Form(
182188
[], description="Outpaint expansion selections, literal 'Left', 'Right', 'Top', 'Bottom' seperated by comma"),
183189
prompt: str = Form(''),
@@ -238,7 +244,7 @@ def as_form(cls, input_image: UploadFile = Form(description="Init image for inpa
238244
errs = ve.errors()
239245
raise RequestValidationError(errors=[errs])
240246

241-
return cls(input_image=input_image, input_mask=input_mask, outpaint_selections=outpaint_selections_arr, prompt=prompt, negative_prompt=negative_prompt, style_selections=style_selection_arr,
247+
return cls(input_image=input_image, input_mask=input_mask, inpaint_additional_prompt=inpaint_additional_prompt, outpaint_selections=outpaint_selections_arr, prompt=prompt, negative_prompt=negative_prompt, style_selections=style_selection_arr,
242248
performance_selection=performance_selection, aspect_ratios_selection=aspect_ratios_selection,
243249
image_number=image_number, image_seed=image_seed, sharpness=sharpness, guidance_scale=guidance_scale,
244250
base_model_name=base_model_name, refiner_model_name=refiner_model_name, refiner_switch=refiner_switch,

0 commit comments

Comments
 (0)