Spaces:
Paused
Paused
Reverting to 079b935
Browse files- args_manager.py +1 -0
- language/en.json +204 -62
- launch.py +10 -7
- ldm_patched/modules/args_parser.py +1 -0
- modules/ui_gradio_extensions.py +5 -0
- requirements.txt +1 -0
- webui.py +626 -588
args_manager.py
CHANGED
@@ -37,6 +37,7 @@ args_parser.parser.add_argument("--always-download-new-model", action='store_tru
|
|
37 |
args_parser.parser.set_defaults(
|
38 |
disable_cuda_malloc=True,
|
39 |
in_browser=True,
|
|
|
40 |
port=None
|
41 |
)
|
42 |
|
|
|
37 |
args_parser.parser.set_defaults(
|
38 |
disable_cuda_malloc=True,
|
39 |
in_browser=True,
|
40 |
+
api_mode=False,
|
41 |
port=None
|
42 |
)
|
43 |
|
language/en.json
CHANGED
@@ -1,14 +1,33 @@
|
|
1 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
"Preview": "Preview",
|
|
|
3 |
"Gallery": "Gallery",
|
4 |
"Generate": "Generate",
|
|
|
5 |
"Skip": "Skip",
|
6 |
"Stop": "Stop",
|
7 |
"Input Image": "Input Image",
|
8 |
"Advanced": "Advanced",
|
9 |
"Upscale or Variation": "Upscale or Variation",
|
10 |
-
"Image Prompt": "Image Prompt",
|
11 |
-
"Inpaint or Outpaint (beta)": "Inpaint or Outpaint (beta)",
|
12 |
"Drag above image to here": "Drag above image to here",
|
13 |
"Upscale or Variation:": "Upscale or Variation:",
|
14 |
"Disabled": "Disabled",
|
@@ -17,50 +36,105 @@
|
|
17 |
"Upscale (1.5x)": "Upscale (1.5x)",
|
18 |
"Upscale (2x)": "Upscale (2x)",
|
19 |
"Upscale (Fast 2x)": "Upscale (Fast 2x)",
|
20 |
-
"\ud83d\udcd4 Document": "\
|
|
|
21 |
"Image": "Image",
|
22 |
"Stop At": "Stop At",
|
23 |
"Weight": "Weight",
|
24 |
"Type": "Type",
|
|
|
25 |
"PyraCanny": "PyraCanny",
|
26 |
"CPDS": "CPDS",
|
27 |
-
"
|
28 |
-
"
|
29 |
-
"
|
30 |
-
"
|
31 |
-
"
|
32 |
-
"
|
33 |
-
"Outpaint": "Outpaint",
|
34 |
"Left": "Left",
|
35 |
"Right": "Right",
|
36 |
"Top": "Top",
|
37 |
"Bottom": "Bottom",
|
38 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
"Setting": "Setting",
|
40 |
-
"Style": "Style",
|
41 |
"Preset": "Preset",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
"Performance": "Performance",
|
43 |
"Speed": "Speed",
|
44 |
-
"Quality": "Quality",
|
45 |
"Extreme Speed": "Extreme Speed",
|
46 |
"Lightning": "Lightning",
|
47 |
"Aspect Ratios": "Aspect Ratios",
|
|
|
48 |
"width \u00d7 height": "width \u00d7 height",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
"Image Number": "Image Number",
|
|
|
|
|
|
|
|
|
50 |
"Negative Prompt": "Negative Prompt",
|
51 |
"Describing what you do not want to see.": "Describing what you do not want to see.",
|
52 |
"Random": "Random",
|
53 |
"Seed": "Seed",
|
54 |
-
"
|
55 |
-
"
|
56 |
-
"
|
57 |
-
"
|
58 |
-
"Image Style": "Image Style",
|
59 |
"Fooocus V2": "Fooocus V2",
|
60 |
-
"
|
|
|
|
|
61 |
"Fooocus Masterpiece": "Fooocus Masterpiece",
|
62 |
"Fooocus Photograph": "Fooocus Photograph",
|
63 |
"Fooocus Negative": "Fooocus Negative",
|
|
|
64 |
"SAI 3D Model": "SAI 3D Model",
|
65 |
"SAI Analog Film": "SAI Analog Film",
|
66 |
"SAI Anime": "SAI Anime",
|
@@ -268,35 +342,90 @@
|
|
268 |
"Volumetric Lighting": "Volumetric Lighting",
|
269 |
"Watercolor 2": "Watercolor 2",
|
270 |
"Whimsical And Playful": "Whimsical And Playful",
|
271 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
"Base Model (SDXL only)": "Base Model (SDXL only)",
|
273 |
-
"
|
274 |
-
"bluePencilXL_v009.safetensors": "bluePencilXL_v009.safetensors",
|
275 |
-
"bluePencilXL_v050.safetensors": "bluePencilXL_v050.safetensors",
|
276 |
-
"DreamShaper_8_pruned.safetensors": "DreamShaper_8_pruned.safetensors",
|
277 |
-
"realisticStockPhoto_v10.safetensors": "realisticStockPhoto_v10.safetensors",
|
278 |
-
"realisticVisionV51_v51VAE.safetensors": "realisticVisionV51_v51VAE.safetensors",
|
279 |
-
"sd_xl_refiner_1.0_0.9vae.safetensors": "sd_xl_refiner_1.0_0.9vae.safetensors",
|
280 |
"Refiner (SDXL or SD 1.5)": "Refiner (SDXL or SD 1.5)",
|
281 |
"None": "None",
|
282 |
-
"
|
283 |
-
"SDXL
|
|
|
|
|
284 |
"sd_xl_offset_example-lora_1.0.safetensors": "sd_xl_offset_example-lora_1.0.safetensors",
|
285 |
-
"
|
286 |
-
"
|
287 |
-
"
|
288 |
-
"
|
289 |
-
"SDXL LoRA 3": "SDXL LoRA 3",
|
290 |
-
"SDXL LoRA 4": "SDXL LoRA 4",
|
291 |
-
"SDXL LoRA 5": "SDXL LoRA 5",
|
292 |
"Refresh": "Refresh",
|
293 |
"\ud83d\udd04 Refresh All Files": "\ud83d\udd04 Refresh All Files",
|
294 |
-
"Sampling Sharpness": "Sampling Sharpness",
|
295 |
-
"Higher value means image and texture are sharper.": "Higher value means image and texture are sharper.",
|
296 |
"Guidance Scale": "Guidance Scale",
|
297 |
"Higher value means style is cleaner, vivider, and more artistic.": "Higher value means style is cleaner, vivider, and more artistic.",
|
|
|
|
|
|
|
298 |
"Developer Debug Mode": "Developer Debug Mode",
|
299 |
-
"
|
300 |
"Positive ADM Guidance Scaler": "Positive ADM Guidance Scaler",
|
301 |
"The scaler multiplied to positive ADM (use 1.0 to disable). ": "The scaler multiplied to positive ADM (use 1.0 to disable). ",
|
302 |
"Negative ADM Guidance Scaler": "Negative ADM Guidance Scaler",
|
@@ -311,10 +440,10 @@
|
|
311 |
"Enabling Fooocus's implementation of CFG mimicking for TSNR (effective when real CFG > mimicked CFG).": "Enabling Fooocus's implementation of CFG mimicking for TSNR (effective when real CFG > mimicked CFG).",
|
312 |
"Sampler": "Sampler",
|
313 |
"dpmpp_2m_sde_gpu": "dpmpp_2m_sde_gpu",
|
314 |
-
"Only effective in non-inpaint mode.": "Only effective in non-inpaint mode.",
|
315 |
"euler": "euler",
|
316 |
"euler_ancestral": "euler_ancestral",
|
317 |
"heun": "heun",
|
|
|
318 |
"dpm_2": "dpm_2",
|
319 |
"dpm_2_ancestral": "dpm_2_ancestral",
|
320 |
"lms": "lms",
|
@@ -333,12 +462,14 @@
|
|
333 |
"uni_pc_bh2": "uni_pc_bh2",
|
334 |
"Scheduler": "Scheduler",
|
335 |
"karras": "karras",
|
336 |
-
"Scheduler of Sampler.": "Scheduler of Sampler.",
|
337 |
"normal": "normal",
|
338 |
"exponential": "exponential",
|
339 |
"sgm_uniform": "sgm_uniform",
|
340 |
"simple": "simple",
|
341 |
"ddim_uniform": "ddim_uniform",
|
|
|
|
|
|
|
342 |
"Forced Overwrite of Sampling Step": "Forced Overwrite of Sampling Step",
|
343 |
"Set as -1 to disable. For developer debugging.": "Set as -1 to disable. For developer debugging.",
|
344 |
"Forced Overwrite of Refiner Switch Step": "Forced Overwrite of Refiner Switch Step",
|
@@ -352,12 +483,22 @@
|
|
352 |
"Disable preview during generation.": "Disable preview during generation.",
|
353 |
"Disable Intermediate Results": "Disable Intermediate Results",
|
354 |
"Disable intermediate results during generation, only show final gallery.": "Disable intermediate results during generation, only show final gallery.",
|
355 |
-
"
|
356 |
-
"
|
357 |
-
"
|
358 |
-
"
|
359 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
"Debug Preprocessors": "Debug Preprocessors",
|
|
|
|
|
|
|
361 |
"Mixing Image Prompt and Vary/Upscale": "Mixing Image Prompt and Vary/Upscale",
|
362 |
"Mixing Image Prompt and Inpaint": "Mixing Image Prompt and Inpaint",
|
363 |
"Softness of ControlNet": "Softness of ControlNet",
|
@@ -365,25 +506,26 @@
|
|
365 |
"Canny": "Canny",
|
366 |
"Canny Low Threshold": "Canny Low Threshold",
|
367 |
"Canny High Threshold": "Canny High Threshold",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
"FreeU": "FreeU",
|
369 |
"Enabled": "Enabled",
|
370 |
"B1": "B1",
|
371 |
"B2": "B2",
|
372 |
"S1": "S1",
|
373 |
-
"S2": "S2"
|
374 |
-
"\uD83D\uDD0E Type here to search styles ...": "\uD83D\uDD0E Type here to search styles ...",
|
375 |
-
"Type prompt here.": "Type prompt here.",
|
376 |
-
"Outpaint Expansion Direction:": "Outpaint Expansion Direction:",
|
377 |
-
"* Powered by Fooocus Inpaint Engine (beta)": "* Powered by Fooocus Inpaint Engine (beta)",
|
378 |
-
"Fooocus Enhance": "Fooocus Enhance",
|
379 |
-
"Fooocus Cinematic": "Fooocus Cinematic",
|
380 |
-
"Fooocus Sharp": "Fooocus Sharp",
|
381 |
-
"Drag any image generated by Fooocus here": "Drag any image generated by Fooocus here",
|
382 |
-
"Metadata": "Metadata",
|
383 |
-
"Apply Metadata": "Apply Metadata",
|
384 |
-
"Metadata Scheme": "Metadata Scheme",
|
385 |
-
"Image Prompt parameters are not included. Use png and a1111 for compatibility with Civitai.": "Image Prompt parameters are not included. Use png and a1111 for compatibility with Civitai.",
|
386 |
-
"fooocus (json)": "fooocus (json)",
|
387 |
-
"a1111 (plain text)": "a1111 (plain text)",
|
388 |
-
"Unsupported image type in input": "Unsupported image type in input"
|
389 |
}
|
|
|
1 |
{
|
2 |
+
"# <center>zStudios Generative Media AI running on CPU</center>": "# <center>zStudios Generative Media AI running on CPU</center>",
|
3 |
+
"DALL-E": "DALL-E",
|
4 |
+
"Model": "Model",
|
5 |
+
"dall-e-3": "dall-e-3",
|
6 |
+
"dall-e-2": "dall-e-2",
|
7 |
+
"Quality": "Quality",
|
8 |
+
"standard": "standard",
|
9 |
+
"hd": "hd",
|
10 |
+
"Size": "Size",
|
11 |
+
"1024x1024": "1024x1024",
|
12 |
+
"256x256": "256x256",
|
13 |
+
"512x512": "512x512",
|
14 |
+
"1792x1024": "1792x1024",
|
15 |
+
"1024x1792": "1024x1792",
|
16 |
+
"Prompt": "Prompt",
|
17 |
+
"Run": "Run",
|
18 |
+
"Image Output": "Image Output",
|
19 |
+
"Fooocus": "Fooocus",
|
20 |
+
"Deactivated": "Deactivated",
|
21 |
"Preview": "Preview",
|
22 |
+
"Finished Images": "Finished Images",
|
23 |
"Gallery": "Gallery",
|
24 |
"Generate": "Generate",
|
25 |
+
"Load Parameters": "Load Parameters",
|
26 |
"Skip": "Skip",
|
27 |
"Stop": "Stop",
|
28 |
"Input Image": "Input Image",
|
29 |
"Advanced": "Advanced",
|
30 |
"Upscale or Variation": "Upscale or Variation",
|
|
|
|
|
31 |
"Drag above image to here": "Drag above image to here",
|
32 |
"Upscale or Variation:": "Upscale or Variation:",
|
33 |
"Disabled": "Disabled",
|
|
|
36 |
"Upscale (1.5x)": "Upscale (1.5x)",
|
37 |
"Upscale (2x)": "Upscale (2x)",
|
38 |
"Upscale (Fast 2x)": "Upscale (Fast 2x)",
|
39 |
+
"<a href=\"https://github.com/lllyasviel/Fooocus/discussions/390\" target=\"_blank\">\ud83d\udcd4 Document</a>": "<a href=\"https://github.com/lllyasviel/Fooocus/discussions/390\" target=\"_blank\">\ud83d\udcd4 Document</a>",
|
40 |
+
"Image Prompt": "Image Prompt",
|
41 |
"Image": "Image",
|
42 |
"Stop At": "Stop At",
|
43 |
"Weight": "Weight",
|
44 |
"Type": "Type",
|
45 |
+
"ImagePrompt": "ImagePrompt",
|
46 |
"PyraCanny": "PyraCanny",
|
47 |
"CPDS": "CPDS",
|
48 |
+
"FaceSwap": "FaceSwap",
|
49 |
+
"* \"Image Prompt\" is powered by Fooocus Image Mixture Engine (v1.0.1). <a href=\"https://github.com/lllyasviel/Fooocus/discussions/557\" target=\"_blank\">\ud83d\udcd4 Document</a>": "* \"Image Prompt\" is powered by Fooocus Image Mixture Engine (v1.0.1). <a href=\"https://github.com/lllyasviel/Fooocus/discussions/557\" target=\"_blank\">\ud83d\udcd4 Document</a>",
|
50 |
+
"Inpaint or Outpaint": "Inpaint or Outpaint",
|
51 |
+
"Drag inpaint or outpaint image to here": "Drag inpaint or outpaint image to here",
|
52 |
+
"Mask Upload": "Mask Upload",
|
53 |
+
"Inpaint Additional Prompt": "Inpaint Additional Prompt",
|
54 |
+
"Outpaint Direction": "Outpaint Direction",
|
55 |
"Left": "Left",
|
56 |
"Right": "Right",
|
57 |
"Top": "Top",
|
58 |
"Bottom": "Bottom",
|
59 |
+
"Method": "Method",
|
60 |
+
"Inpaint or Outpaint (default)": "Inpaint or Outpaint (default)",
|
61 |
+
"Improve Detail (face, hand, eyes, etc.)": "Improve Detail (face, hand, eyes, etc.)",
|
62 |
+
"Modify Content (add objects, change background, etc.)": "Modify Content (add objects, change background, etc.)",
|
63 |
+
"Additional Prompt Quick List": "Additional Prompt Quick List",
|
64 |
+
"* Powered by Fooocus Inpaint Engine <a href=\"https://github.com/lllyasviel/Fooocus/discussions/414\" target=\"_blank\">\ud83d\udcd4 Document</a>": "* Powered by Fooocus Inpaint Engine <a href=\"https://github.com/lllyasviel/Fooocus/discussions/414\" target=\"_blank\">\ud83d\udcd4 Document</a>",
|
65 |
+
"Describe": "Describe",
|
66 |
+
"Drag any image to here": "Drag any image to here",
|
67 |
+
"Content Type": "Content Type",
|
68 |
+
"Photograph": "Photograph",
|
69 |
+
"Art/Anime": "Art/Anime",
|
70 |
+
"Describe this Image into Prompt": "Describe this Image into Prompt",
|
71 |
+
"<a href=\"https://github.com/lllyasviel/Fooocus/discussions/1363\" target=\"_blank\">\ud83d\udcd4 Document</a>": "<a href=\"https://github.com/lllyasviel/Fooocus/discussions/1363\" target=\"_blank\">\ud83d\udcd4 Document</a>",
|
72 |
+
"Metadata": "Metadata",
|
73 |
+
"Drag any image generated by Fooocus here": "Drag any image generated by Fooocus here",
|
74 |
+
"Apply Metadata": "Apply Metadata",
|
75 |
+
"uov": "uov",
|
76 |
"Setting": "Setting",
|
|
|
77 |
"Preset": "Preset",
|
78 |
+
"initial": "initial",
|
79 |
+
"realistic": "realistic",
|
80 |
+
"lightning": "lightning",
|
81 |
+
"anime": "anime",
|
82 |
+
"sai": "sai",
|
83 |
+
"default": "default",
|
84 |
+
"lcm": "lcm",
|
85 |
"Performance": "Performance",
|
86 |
"Speed": "Speed",
|
|
|
87 |
"Extreme Speed": "Extreme Speed",
|
88 |
"Lightning": "Lightning",
|
89 |
"Aspect Ratios": "Aspect Ratios",
|
90 |
+
"1152\u00d7896 <span style=\"color: grey;\"> \u2223 9:7</span>": "1152\u00d7896 <span style=\"color: grey;\"> \u2223 9:7</span>",
|
91 |
"width \u00d7 height": "width \u00d7 height",
|
92 |
+
"704\u00d71408 <span style=\"color: grey;\"> \u2223 1:2</span>": "704\u00d71408 <span style=\"color: grey;\"> \u2223 1:2</span>",
|
93 |
+
"704\u00d71344 <span style=\"color: grey;\"> \u2223 11:21</span>": "704\u00d71344 <span style=\"color: grey;\"> \u2223 11:21</span>",
|
94 |
+
"768\u00d71344 <span style=\"color: grey;\"> \u2223 4:7</span>": "768\u00d71344 <span style=\"color: grey;\"> \u2223 4:7</span>",
|
95 |
+
"768\u00d71280 <span style=\"color: grey;\"> \u2223 3:5</span>": "768\u00d71280 <span style=\"color: grey;\"> \u2223 3:5</span>",
|
96 |
+
"832\u00d71216 <span style=\"color: grey;\"> \u2223 13:19</span>": "832\u00d71216 <span style=\"color: grey;\"> \u2223 13:19</span>",
|
97 |
+
"832\u00d71152 <span style=\"color: grey;\"> \u2223 13:18</span>": "832\u00d71152 <span style=\"color: grey;\"> \u2223 13:18</span>",
|
98 |
+
"896\u00d71152 <span style=\"color: grey;\"> \u2223 7:9</span>": "896\u00d71152 <span style=\"color: grey;\"> \u2223 7:9</span>",
|
99 |
+
"896\u00d71088 <span style=\"color: grey;\"> \u2223 14:17</span>": "896\u00d71088 <span style=\"color: grey;\"> \u2223 14:17</span>",
|
100 |
+
"960\u00d71088 <span style=\"color: grey;\"> \u2223 15:17</span>": "960\u00d71088 <span style=\"color: grey;\"> \u2223 15:17</span>",
|
101 |
+
"960\u00d71024 <span style=\"color: grey;\"> \u2223 15:16</span>": "960\u00d71024 <span style=\"color: grey;\"> \u2223 15:16</span>",
|
102 |
+
"1024\u00d71024 <span style=\"color: grey;\"> \u2223 1:1</span>": "1024\u00d71024 <span style=\"color: grey;\"> \u2223 1:1</span>",
|
103 |
+
"1024\u00d7960 <span style=\"color: grey;\"> \u2223 16:15</span>": "1024\u00d7960 <span style=\"color: grey;\"> \u2223 16:15</span>",
|
104 |
+
"1088\u00d7960 <span style=\"color: grey;\"> \u2223 17:15</span>": "1088\u00d7960 <span style=\"color: grey;\"> \u2223 17:15</span>",
|
105 |
+
"1088\u00d7896 <span style=\"color: grey;\"> \u2223 17:14</span>": "1088\u00d7896 <span style=\"color: grey;\"> \u2223 17:14</span>",
|
106 |
+
"1152\u00d7832 <span style=\"color: grey;\"> \u2223 18:13</span>": "1152\u00d7832 <span style=\"color: grey;\"> \u2223 18:13</span>",
|
107 |
+
"1216\u00d7832 <span style=\"color: grey;\"> \u2223 19:13</span>": "1216\u00d7832 <span style=\"color: grey;\"> \u2223 19:13</span>",
|
108 |
+
"1280\u00d7768 <span style=\"color: grey;\"> \u2223 5:3</span>": "1280\u00d7768 <span style=\"color: grey;\"> \u2223 5:3</span>",
|
109 |
+
"1344\u00d7768 <span style=\"color: grey;\"> \u2223 7:4</span>": "1344\u00d7768 <span style=\"color: grey;\"> \u2223 7:4</span>",
|
110 |
+
"1344\u00d7704 <span style=\"color: grey;\"> \u2223 21:11</span>": "1344\u00d7704 <span style=\"color: grey;\"> \u2223 21:11</span>",
|
111 |
+
"1408\u00d7704 <span style=\"color: grey;\"> \u2223 2:1</span>": "1408\u00d7704 <span style=\"color: grey;\"> \u2223 2:1</span>",
|
112 |
+
"1472\u00d7704 <span style=\"color: grey;\"> \u2223 23:11</span>": "1472\u00d7704 <span style=\"color: grey;\"> \u2223 23:11</span>",
|
113 |
+
"1536\u00d7640 <span style=\"color: grey;\"> \u2223 12:5</span>": "1536\u00d7640 <span style=\"color: grey;\"> \u2223 12:5</span>",
|
114 |
+
"1600\u00d7640 <span style=\"color: grey;\"> \u2223 5:2</span>": "1600\u00d7640 <span style=\"color: grey;\"> \u2223 5:2</span>",
|
115 |
+
"1664\u00d7576 <span style=\"color: grey;\"> \u2223 26:9</span>": "1664\u00d7576 <span style=\"color: grey;\"> \u2223 26:9</span>",
|
116 |
+
"1728\u00d7576 <span style=\"color: grey;\"> \u2223 3:1</span>": "1728\u00d7576 <span style=\"color: grey;\"> \u2223 3:1</span>",
|
117 |
"Image Number": "Image Number",
|
118 |
+
"Output Format": "Output Format",
|
119 |
+
"png": "png",
|
120 |
+
"jpeg": "jpeg",
|
121 |
+
"webp": "webp",
|
122 |
"Negative Prompt": "Negative Prompt",
|
123 |
"Describing what you do not want to see.": "Describing what you do not want to see.",
|
124 |
"Random": "Random",
|
125 |
"Seed": "Seed",
|
126 |
+
"0": "0",
|
127 |
+
"Style": "Style",
|
128 |
+
"Search Styles": "Search Styles",
|
129 |
+
"Selected Styles": "Selected Styles",
|
|
|
130 |
"Fooocus V2": "Fooocus V2",
|
131 |
+
"Fooocus Enhance": "Fooocus Enhance",
|
132 |
+
"Fooocus Sharp": "Fooocus Sharp",
|
133 |
+
"Fooocus Semi Realistic": "Fooocus Semi Realistic",
|
134 |
"Fooocus Masterpiece": "Fooocus Masterpiece",
|
135 |
"Fooocus Photograph": "Fooocus Photograph",
|
136 |
"Fooocus Negative": "Fooocus Negative",
|
137 |
+
"Fooocus Cinematic": "Fooocus Cinematic",
|
138 |
"SAI 3D Model": "SAI 3D Model",
|
139 |
"SAI Analog Film": "SAI Analog Film",
|
140 |
"SAI Anime": "SAI Anime",
|
|
|
342 |
"Volumetric Lighting": "Volumetric Lighting",
|
343 |
"Watercolor 2": "Watercolor 2",
|
344 |
"Whimsical And Playful": "Whimsical And Playful",
|
345 |
+
"Mk Chromolithography": "Mk Chromolithography",
|
346 |
+
"Mk Cross Processing Print": "Mk Cross Processing Print",
|
347 |
+
"Mk Dufaycolor Photograph": "Mk Dufaycolor Photograph",
|
348 |
+
"Mk Herbarium": "Mk Herbarium",
|
349 |
+
"Mk Punk Collage": "Mk Punk Collage",
|
350 |
+
"Mk Mosaic": "Mk Mosaic",
|
351 |
+
"Mk Van Gogh": "Mk Van Gogh",
|
352 |
+
"Mk Coloring Book": "Mk Coloring Book",
|
353 |
+
"Mk Singer Sargent": "Mk Singer Sargent",
|
354 |
+
"Mk Pollock": "Mk Pollock",
|
355 |
+
"Mk Basquiat": "Mk Basquiat",
|
356 |
+
"Mk Andy Warhol": "Mk Andy Warhol",
|
357 |
+
"Mk Halftone Print": "Mk Halftone Print",
|
358 |
+
"Mk Gond Painting": "Mk Gond Painting",
|
359 |
+
"Mk Albumen Print": "Mk Albumen Print",
|
360 |
+
"Mk Aquatint Print": "Mk Aquatint Print",
|
361 |
+
"Mk Anthotype Print": "Mk Anthotype Print",
|
362 |
+
"Mk Inuit Carving": "Mk Inuit Carving",
|
363 |
+
"Mk Bromoil Print": "Mk Bromoil Print",
|
364 |
+
"Mk Calotype Print": "Mk Calotype Print",
|
365 |
+
"Mk Color Sketchnote": "Mk Color Sketchnote",
|
366 |
+
"Mk Cibulak Porcelain": "Mk Cibulak Porcelain",
|
367 |
+
"Mk Alcohol Ink Art": "Mk Alcohol Ink Art",
|
368 |
+
"Mk One Line Art": "Mk One Line Art",
|
369 |
+
"Mk Blacklight Paint": "Mk Blacklight Paint",
|
370 |
+
"Mk Carnival Glass": "Mk Carnival Glass",
|
371 |
+
"Mk Cyanotype Print": "Mk Cyanotype Print",
|
372 |
+
"Mk Cross Stitching": "Mk Cross Stitching",
|
373 |
+
"Mk Encaustic Paint": "Mk Encaustic Paint",
|
374 |
+
"Mk Embroidery": "Mk Embroidery",
|
375 |
+
"Mk Gyotaku": "Mk Gyotaku",
|
376 |
+
"Mk Luminogram": "Mk Luminogram",
|
377 |
+
"Mk Lite Brite Art": "Mk Lite Brite Art",
|
378 |
+
"Mk Mokume Gane": "Mk Mokume Gane",
|
379 |
+
"Pebble Art": "Pebble Art",
|
380 |
+
"Mk Palekh": "Mk Palekh",
|
381 |
+
"Mk Suminagashi": "Mk Suminagashi",
|
382 |
+
"Mk Scrimshaw": "Mk Scrimshaw",
|
383 |
+
"Mk Shibori": "Mk Shibori",
|
384 |
+
"Mk Vitreous Enamel": "Mk Vitreous Enamel",
|
385 |
+
"Mk Ukiyo E": "Mk Ukiyo E",
|
386 |
+
"Mk Vintage Airline Poster": "Mk Vintage Airline Poster",
|
387 |
+
"Mk Vintage Travel Poster": "Mk Vintage Travel Poster",
|
388 |
+
"Mk Bauhaus Style": "Mk Bauhaus Style",
|
389 |
+
"Mk Afrofuturism": "Mk Afrofuturism",
|
390 |
+
"Mk Atompunk": "Mk Atompunk",
|
391 |
+
"Mk Constructivism": "Mk Constructivism",
|
392 |
+
"Mk Chicano Art": "Mk Chicano Art",
|
393 |
+
"Mk De Stijl": "Mk De Stijl",
|
394 |
+
"Mk Dayak Art": "Mk Dayak Art",
|
395 |
+
"Mk Fayum Portrait": "Mk Fayum Portrait",
|
396 |
+
"Mk Illuminated Manuscript": "Mk Illuminated Manuscript",
|
397 |
+
"Mk Kalighat Painting": "Mk Kalighat Painting",
|
398 |
+
"Mk Madhubani Painting": "Mk Madhubani Painting",
|
399 |
+
"Mk Pictorialism": "Mk Pictorialism",
|
400 |
+
"Mk Pichwai Painting": "Mk Pichwai Painting",
|
401 |
+
"Mk Patachitra Painting": "Mk Patachitra Painting",
|
402 |
+
"Mk Samoan Art Inspired": "Mk Samoan Art Inspired",
|
403 |
+
"Mk Tlingit Art": "Mk Tlingit Art",
|
404 |
+
"Mk Adnate Style": "Mk Adnate Style",
|
405 |
+
"Mk Ron English Style": "Mk Ron English Style",
|
406 |
+
"Mk Shepard Fairey Style": "Mk Shepard Fairey Style",
|
407 |
"Base Model (SDXL only)": "Base Model (SDXL only)",
|
408 |
+
"juggernautXL_v8Rundiffusion.safetensors": "juggernautXL_v8Rundiffusion.safetensors",
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
"Refiner (SDXL or SD 1.5)": "Refiner (SDXL or SD 1.5)",
|
410 |
"None": "None",
|
411 |
+
"Refiner Switch At": "Refiner Switch At",
|
412 |
+
"Use 0.4 for SD1.5 realistic models; or 0.667 for SD1.5 anime models; or 0.8 for XL-refiners; or any value for switching two SDXL models.": "Use 0.4 for SD1.5 realistic models; or 0.667 for SD1.5 anime models; or 0.8 for XL-refiners; or any value for switching two SDXL models.",
|
413 |
+
"Enable": "Enable",
|
414 |
+
"LoRA 1": "LoRA 1",
|
415 |
"sd_xl_offset_example-lora_1.0.safetensors": "sd_xl_offset_example-lora_1.0.safetensors",
|
416 |
+
"LoRA 2": "LoRA 2",
|
417 |
+
"LoRA 3": "LoRA 3",
|
418 |
+
"LoRA 4": "LoRA 4",
|
419 |
+
"LoRA 5": "LoRA 5",
|
|
|
|
|
|
|
420 |
"Refresh": "Refresh",
|
421 |
"\ud83d\udd04 Refresh All Files": "\ud83d\udd04 Refresh All Files",
|
|
|
|
|
422 |
"Guidance Scale": "Guidance Scale",
|
423 |
"Higher value means style is cleaner, vivider, and more artistic.": "Higher value means style is cleaner, vivider, and more artistic.",
|
424 |
+
"Image Sharpness": "Image Sharpness",
|
425 |
+
"Higher value means image and texture are sharper.": "Higher value means image and texture are sharper.",
|
426 |
+
"<a href=\"https://github.com/lllyasviel/Fooocus/discussions/117\" target=\"_blank\">\ud83d\udcd4 Document</a>": "<a href=\"https://github.com/lllyasviel/Fooocus/discussions/117\" target=\"_blank\">\ud83d\udcd4 Document</a>",
|
427 |
"Developer Debug Mode": "Developer Debug Mode",
|
428 |
+
"Debug Tools": "Debug Tools",
|
429 |
"Positive ADM Guidance Scaler": "Positive ADM Guidance Scaler",
|
430 |
"The scaler multiplied to positive ADM (use 1.0 to disable). ": "The scaler multiplied to positive ADM (use 1.0 to disable). ",
|
431 |
"Negative ADM Guidance Scaler": "Negative ADM Guidance Scaler",
|
|
|
440 |
"Enabling Fooocus's implementation of CFG mimicking for TSNR (effective when real CFG > mimicked CFG).": "Enabling Fooocus's implementation of CFG mimicking for TSNR (effective when real CFG > mimicked CFG).",
|
441 |
"Sampler": "Sampler",
|
442 |
"dpmpp_2m_sde_gpu": "dpmpp_2m_sde_gpu",
|
|
|
443 |
"euler": "euler",
|
444 |
"euler_ancestral": "euler_ancestral",
|
445 |
"heun": "heun",
|
446 |
+
"heunpp2": "heunpp2",
|
447 |
"dpm_2": "dpm_2",
|
448 |
"dpm_2_ancestral": "dpm_2_ancestral",
|
449 |
"lms": "lms",
|
|
|
462 |
"uni_pc_bh2": "uni_pc_bh2",
|
463 |
"Scheduler": "Scheduler",
|
464 |
"karras": "karras",
|
|
|
465 |
"normal": "normal",
|
466 |
"exponential": "exponential",
|
467 |
"sgm_uniform": "sgm_uniform",
|
468 |
"simple": "simple",
|
469 |
"ddim_uniform": "ddim_uniform",
|
470 |
+
"turbo": "turbo",
|
471 |
+
"Generate Image Grid for Each Batch": "Generate Image Grid for Each Batch",
|
472 |
+
"(Experimental) This may cause performance problems on some computers and certain internet conditions.": "(Experimental) This may cause performance problems on some computers and certain internet conditions.",
|
473 |
"Forced Overwrite of Sampling Step": "Forced Overwrite of Sampling Step",
|
474 |
"Set as -1 to disable. For developer debugging.": "Set as -1 to disable. For developer debugging.",
|
475 |
"Forced Overwrite of Refiner Switch Step": "Forced Overwrite of Refiner Switch Step",
|
|
|
483 |
"Disable preview during generation.": "Disable preview during generation.",
|
484 |
"Disable Intermediate Results": "Disable Intermediate Results",
|
485 |
"Disable intermediate results during generation, only show final gallery.": "Disable intermediate results during generation, only show final gallery.",
|
486 |
+
"Disable seed increment": "Disable seed increment",
|
487 |
+
"Disable automatic seed increment when image number is > 1.": "Disable automatic seed increment when image number is > 1.",
|
488 |
+
"Read wildcards in order": "Read wildcards in order",
|
489 |
+
"Save Metadata to Images": "Save Metadata to Images",
|
490 |
+
"Adds parameters to generated images allowing manual regeneration.": "Adds parameters to generated images allowing manual regeneration.",
|
491 |
+
"Metadata Scheme": "Metadata Scheme",
|
492 |
+
"fooocus": "fooocus",
|
493 |
+
"Image Prompt parameters are not included. Use png and a1111 for compatibility with Civitai.": "Image Prompt parameters are not included. Use png and a1111 for compatibility with Civitai.",
|
494 |
+
"fooocus (json)": "fooocus (json)",
|
495 |
+
"a1111 (plain text)": "a1111 (plain text)",
|
496 |
+
"a1111": "a1111",
|
497 |
+
"Control": "Control",
|
498 |
"Debug Preprocessors": "Debug Preprocessors",
|
499 |
+
"See the results from preprocessors.": "See the results from preprocessors.",
|
500 |
+
"Skip Preprocessors": "Skip Preprocessors",
|
501 |
+
"Do not preprocess images. (Inputs are already canny/depth/cropped-face/etc.)": "Do not preprocess images. (Inputs are already canny/depth/cropped-face/etc.)",
|
502 |
"Mixing Image Prompt and Vary/Upscale": "Mixing Image Prompt and Vary/Upscale",
|
503 |
"Mixing Image Prompt and Inpaint": "Mixing Image Prompt and Inpaint",
|
504 |
"Softness of ControlNet": "Softness of ControlNet",
|
|
|
506 |
"Canny": "Canny",
|
507 |
"Canny Low Threshold": "Canny Low Threshold",
|
508 |
"Canny High Threshold": "Canny High Threshold",
|
509 |
+
"Inpaint": "Inpaint",
|
510 |
+
"Debug Inpaint Preprocessing": "Debug Inpaint Preprocessing",
|
511 |
+
"Disable initial latent in inpaint": "Disable initial latent in inpaint",
|
512 |
+
"Inpaint Engine": "Inpaint Engine",
|
513 |
+
"v2.6": "v2.6",
|
514 |
+
"Version of Fooocus inpaint model": "Version of Fooocus inpaint model",
|
515 |
+
"v1": "v1",
|
516 |
+
"v2.5": "v2.5",
|
517 |
+
"Inpaint Denoising Strength": "Inpaint Denoising Strength",
|
518 |
+
"Same as the denoising strength in A1111 inpaint. Only used in inpaint, not used in outpaint. (Outpaint always use 1.0)": "Same as the denoising strength in A1111 inpaint. Only used in inpaint, not used in outpaint. (Outpaint always use 1.0)",
|
519 |
+
"Inpaint Respective Field": "Inpaint Respective Field",
|
520 |
+
"The area to inpaint. Value 0 is same as \"Only Masked\" in A1111. Value 1 is same as \"Whole Image\" in A1111. Only used in inpaint, not used in outpaint. (Outpaint always use 1.0)": "The area to inpaint. Value 0 is same as \"Only Masked\" in A1111. Value 1 is same as \"Whole Image\" in A1111. Only used in inpaint, not used in outpaint. (Outpaint always use 1.0)",
|
521 |
+
"Mask Erode or Dilate": "Mask Erode or Dilate",
|
522 |
+
"Positive value will make white area in the mask larger, negative value will make white area smaller.(default is 0, always process before any mask invert)": "Positive value will make white area in the mask larger, negative value will make white area smaller.(default is 0, always process before any mask invert)",
|
523 |
+
"Enable Mask Upload": "Enable Mask Upload",
|
524 |
+
"Invert Mask": "Invert Mask",
|
525 |
"FreeU": "FreeU",
|
526 |
"Enabled": "Enabled",
|
527 |
"B1": "B1",
|
528 |
"B2": "B2",
|
529 |
"S1": "S1",
|
530 |
+
"S2": "S2"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
}
|
launch.py
CHANGED
@@ -27,6 +27,7 @@ TRY_INSTALL_XFORMERS = False
|
|
27 |
|
28 |
|
29 |
def prepare_environment():
|
|
|
30 |
torch_index_url = os.environ.get('TORCH_INDEX_URL', "https://download.pytorch.org/whl/cu121")
|
31 |
torch_command = os.environ.get('TORCH_COMMAND',
|
32 |
f"pip install torch==2.1.0 torchvision==0.16.0 --extra-index-url {torch_index_url}")
|
@@ -71,10 +72,12 @@ def ini_args():
|
|
71 |
from args_manager import args
|
72 |
return args
|
73 |
|
74 |
-
|
75 |
-
prepare_environment()
|
76 |
-
build_launcher()
|
77 |
args = ini_args()
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
if args.gpu_device_id is not None:
|
80 |
os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpu_device_id)
|
@@ -128,9 +131,9 @@ def download_models(default_model, previous_default_models, checkpoint_downloads
|
|
128 |
|
129 |
return default_model, checkpoint_downloads
|
130 |
|
131 |
-
|
132 |
-
config.default_base_model_name, config.checkpoint_downloads = download_models(
|
133 |
-
|
134 |
-
|
135 |
|
136 |
from webui import *
|
|
|
27 |
|
28 |
|
29 |
def prepare_environment():
|
30 |
+
|
31 |
torch_index_url = os.environ.get('TORCH_INDEX_URL', "https://download.pytorch.org/whl/cu121")
|
32 |
torch_command = os.environ.get('TORCH_COMMAND',
|
33 |
f"pip install torch==2.1.0 torchvision==0.16.0 --extra-index-url {torch_index_url}")
|
|
|
72 |
from args_manager import args
|
73 |
return args
|
74 |
|
|
|
|
|
|
|
75 |
args = ini_args()
|
76 |
+
if not args.api_mode:
|
77 |
+
prepare_environment()
|
78 |
+
build_launcher()
|
79 |
+
args = ini_args()
|
80 |
+
|
81 |
|
82 |
if args.gpu_device_id is not None:
|
83 |
os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpu_device_id)
|
|
|
131 |
|
132 |
return default_model, checkpoint_downloads
|
133 |
|
134 |
+
if not args.api_mode:
|
135 |
+
config.default_base_model_name, config.checkpoint_downloads = download_models(
|
136 |
+
config.default_base_model_name, config.previous_default_models, config.checkpoint_downloads,
|
137 |
+
config.embeddings_downloads, config.lora_downloads)
|
138 |
|
139 |
from webui import *
|
ldm_patched/modules/args_parser.py
CHANGED
@@ -46,6 +46,7 @@ parser.add_argument("--in-browser", action="store_true")
|
|
46 |
parser.add_argument("--disable-in-browser", action="store_true")
|
47 |
parser.add_argument("--gpu-device-id", type=int, default=None, metavar="DEVICE_ID")
|
48 |
cm_group = parser.add_mutually_exclusive_group()
|
|
|
49 |
cm_group.add_argument("--async-cuda-allocation", action="store_true")
|
50 |
cm_group.add_argument("--disable-async-cuda-allocation", action="store_true")
|
51 |
|
|
|
46 |
parser.add_argument("--disable-in-browser", action="store_true")
|
47 |
parser.add_argument("--gpu-device-id", type=int, default=None, metavar="DEVICE_ID")
|
48 |
cm_group = parser.add_mutually_exclusive_group()
|
49 |
+
parser.add_argument("--api-mode", action="store_true")
|
50 |
cm_group.add_argument("--async-cuda-allocation", action="store_true")
|
51 |
cm_group.add_argument("--disable-async-cuda-allocation", action="store_true")
|
52 |
|
modules/ui_gradio_extensions.py
CHANGED
@@ -52,6 +52,11 @@ def css_html():
|
|
52 |
head = f'<link rel="stylesheet" property="stylesheet" href="{style_css_path}">'
|
53 |
return head
|
54 |
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
def reload_javascript():
|
57 |
js = javascript_html()
|
|
|
52 |
head = f'<link rel="stylesheet" property="stylesheet" href="{style_css_path}">'
|
53 |
return head
|
54 |
|
55 |
+
def zStudiosHeader(power_device):
|
56 |
+
logo_path = webpath('backstage.png')
|
57 |
+
zHead = f"""<table><tr><td><img src="{logo_path}" width="36" height="36"/></td><td><font size="5">zStudios Generative Media AI running on {power_device}</font></td></tr></table>"""
|
58 |
+
return zHead
|
59 |
+
|
60 |
|
61 |
def reload_javascript():
|
62 |
js = javascript_html()
|
requirements.txt
CHANGED
@@ -20,3 +20,4 @@ timm==0.9.2
|
|
20 |
diffusers
|
21 |
invisible_watermark
|
22 |
xformers
|
|
|
|
20 |
diffusers
|
21 |
invisible_watermark
|
22 |
xformers
|
23 |
+
openai==1.2.3
|
webui.py
CHANGED
@@ -16,6 +16,7 @@ import modules.meta_parser
|
|
16 |
import args_manager
|
17 |
import copy
|
18 |
import launch
|
|
|
19 |
|
20 |
from modules.sdxl_styles import legal_style_names
|
21 |
from modules.private_logger import get_current_html_path
|
@@ -23,6 +24,15 @@ from modules.ui_gradio_extensions import reload_javascript
|
|
23 |
from modules.auth import auth_enabled, check_auth
|
24 |
from modules.util import is_json
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
def get_task(*args):
|
27 |
args = list(args)
|
28 |
args.pop(0)
|
@@ -96,614 +106,642 @@ title = f'Fooocus {fooocus_version.version}'
|
|
96 |
if isinstance(args_manager.args.preset, str):
|
97 |
title += ' ' + args_manager.args.preset
|
98 |
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
with shared.gradio_root:
|
102 |
-
|
103 |
-
with gr.
|
104 |
-
with gr.
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
with gr.Column():
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
with gr.Column():
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
value=flags.desc_type_photo)
|
222 |
-
desc_btn = gr.Button(value='Describe this Image into Prompt')
|
223 |
-
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/1363" target="_blank">\U0001F4D4 Document</a>')
|
224 |
-
with gr.TabItem(label='Metadata') as load_tab:
|
225 |
-
with gr.Column():
|
226 |
-
metadata_input_image = grh.Image(label='Drag any image generated by Fooocus here', source='upload', type='filepath')
|
227 |
-
metadata_json = gr.JSON(label='Metadata')
|
228 |
-
metadata_import_button = gr.Button(value='Apply Metadata')
|
229 |
-
|
230 |
-
def trigger_metadata_preview(filepath):
|
231 |
-
parameters, metadata_scheme = modules.meta_parser.read_info_from_image(filepath)
|
232 |
-
|
233 |
-
results = {}
|
234 |
-
if parameters is not None:
|
235 |
-
results['parameters'] = parameters
|
236 |
-
|
237 |
-
if isinstance(metadata_scheme, flags.MetadataScheme):
|
238 |
-
results['metadata_scheme'] = metadata_scheme.value
|
239 |
-
|
240 |
-
return results
|
241 |
-
|
242 |
-
metadata_input_image.upload(trigger_metadata_preview, inputs=metadata_input_image,
|
243 |
-
outputs=metadata_json, queue=False, show_progress=True)
|
244 |
-
|
245 |
-
switch_js = "(x) => {if(x){viewer_to_bottom(100);viewer_to_bottom(500);}else{viewer_to_top();} return x;}"
|
246 |
-
down_js = "() => {viewer_to_bottom();}"
|
247 |
-
|
248 |
-
input_image_checkbox.change(lambda x: gr.update(visible=x), inputs=input_image_checkbox,
|
249 |
-
outputs=image_input_panel, queue=False, show_progress=False, _js=switch_js)
|
250 |
-
ip_advanced.change(lambda: None, queue=False, show_progress=False, _js=down_js)
|
251 |
-
|
252 |
-
current_tab = gr.Textbox(value='uov', visible=False)
|
253 |
-
uov_tab.select(lambda: 'uov', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
254 |
-
inpaint_tab.select(lambda: 'inpaint', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
255 |
-
ip_tab.select(lambda: 'ip', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
256 |
-
desc_tab.select(lambda: 'desc', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
257 |
-
|
258 |
-
with gr.Column(scale=1, visible=modules.config.default_advanced_checkbox) as advanced_column:
|
259 |
-
with gr.Tab(label='Setting'):
|
260 |
-
if not args_manager.args.disable_preset_selection:
|
261 |
-
preset_selection = gr.Radio(label='Preset',
|
262 |
-
choices=modules.config.available_presets,
|
263 |
-
value=args_manager.args.preset if args_manager.args.preset else "initial",
|
264 |
-
interactive=True)
|
265 |
-
performance_selection = gr.Radio(label='Performance',
|
266 |
-
choices=flags.Performance.list(),
|
267 |
-
value=modules.config.default_performance)
|
268 |
-
aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=modules.config.available_aspect_ratios,
|
269 |
-
value=modules.config.default_aspect_ratio, info='width × height',
|
270 |
-
elem_classes='aspect_ratios')
|
271 |
-
image_number = gr.Slider(label='Image Number', minimum=1, maximum=modules.config.default_max_image_number, step=1, value=modules.config.default_image_number)
|
272 |
-
|
273 |
-
output_format = gr.Radio(label='Output Format',
|
274 |
-
choices=flags.OutputFormat.list(),
|
275 |
-
value=modules.config.default_output_format)
|
276 |
-
|
277 |
-
negative_prompt = gr.Textbox(label='Negative Prompt', show_label=True, placeholder="Type prompt here.",
|
278 |
-
info='Describing what you do not want to see.', lines=2,
|
279 |
-
elem_id='negative_prompt',
|
280 |
-
value=modules.config.default_prompt_negative)
|
281 |
-
seed_random = gr.Checkbox(label='Random', value=True)
|
282 |
-
image_seed = gr.Textbox(label='Seed', value=0, max_lines=1, visible=False) # workaround for https://github.com/gradio-app/gradio/issues/5354
|
283 |
-
|
284 |
-
def random_checked(r):
|
285 |
-
return gr.update(visible=not r)
|
286 |
-
|
287 |
-
def refresh_seed(r, seed_string):
|
288 |
-
if r:
|
289 |
-
return random.randint(constants.MIN_SEED, constants.MAX_SEED)
|
290 |
-
else:
|
291 |
-
try:
|
292 |
-
seed_value = int(seed_string)
|
293 |
-
if constants.MIN_SEED <= seed_value <= constants.MAX_SEED:
|
294 |
-
return seed_value
|
295 |
-
except ValueError:
|
296 |
-
pass
|
297 |
-
return random.randint(constants.MIN_SEED, constants.MAX_SEED)
|
298 |
-
|
299 |
-
seed_random.change(random_checked, inputs=[seed_random], outputs=[image_seed],
|
300 |
-
queue=False, show_progress=False)
|
301 |
-
|
302 |
-
def update_history_link():
|
303 |
-
if args_manager.args.disable_image_log:
|
304 |
-
return gr.update(value='')
|
305 |
-
|
306 |
-
return gr.update(value=f'<a href="file={get_current_html_path(output_format)}" target="_blank">\U0001F4DA History Log</a>')
|
307 |
-
|
308 |
-
history_link = gr.HTML()
|
309 |
-
shared.gradio_root.load(update_history_link, outputs=history_link, queue=False, show_progress=False)
|
310 |
-
|
311 |
-
with gr.Tab(label='Style', elem_classes=['style_selections_tab']):
|
312 |
-
style_sorter.try_load_sorted_styles(
|
313 |
-
style_names=legal_style_names,
|
314 |
-
default_selected=modules.config.default_styles)
|
315 |
-
|
316 |
-
style_search_bar = gr.Textbox(show_label=False, container=False,
|
317 |
-
placeholder="\U0001F50E Type here to search styles ...",
|
318 |
-
value="",
|
319 |
-
label='Search Styles')
|
320 |
-
style_selections = gr.CheckboxGroup(show_label=False, container=False,
|
321 |
-
choices=copy.deepcopy(style_sorter.all_styles),
|
322 |
-
value=copy.deepcopy(modules.config.default_styles),
|
323 |
-
label='Selected Styles',
|
324 |
-
elem_classes=['style_selections'])
|
325 |
-
gradio_receiver_style_selections = gr.Textbox(elem_id='gradio_receiver_style_selections', visible=False)
|
326 |
-
|
327 |
-
shared.gradio_root.load(lambda: gr.update(choices=copy.deepcopy(style_sorter.all_styles)),
|
328 |
-
outputs=style_selections)
|
329 |
-
|
330 |
-
style_search_bar.change(style_sorter.search_styles,
|
331 |
-
inputs=[style_selections, style_search_bar],
|
332 |
-
outputs=style_selections,
|
333 |
-
queue=False,
|
334 |
-
show_progress=False).then(
|
335 |
-
lambda: None, _js='()=>{refresh_style_localization();}')
|
336 |
-
|
337 |
-
gradio_receiver_style_selections.input(style_sorter.sort_styles,
|
338 |
-
inputs=style_selections,
|
339 |
-
outputs=style_selections,
|
340 |
-
queue=False,
|
341 |
-
show_progress=False).then(
|
342 |
-
lambda: None, _js='()=>{refresh_style_localization();}')
|
343 |
-
|
344 |
-
with gr.Tab(label='Model'):
|
345 |
-
with gr.Group():
|
346 |
-
with gr.Row():
|
347 |
-
base_model = gr.Dropdown(label='Base Model (SDXL only)', choices=modules.config.model_filenames, value=modules.config.default_base_model_name, show_label=True)
|
348 |
-
refiner_model = gr.Dropdown(label='Refiner (SDXL or SD 1.5)', choices=['None'] + modules.config.model_filenames, value=modules.config.default_refiner_model_name, show_label=True)
|
349 |
|
350 |
-
|
351 |
-
|
352 |
-
'or 0.667 for SD1.5 anime models; '
|
353 |
-
'or 0.8 for XL-refiners; '
|
354 |
-
'or any value for switching two SDXL models.',
|
355 |
-
value=modules.config.default_refiner_switch,
|
356 |
-
visible=modules.config.default_refiner_model_name != 'None')
|
357 |
|
358 |
-
|
359 |
-
|
|
|
360 |
|
361 |
-
|
362 |
-
|
363 |
|
364 |
-
|
365 |
-
with gr.Row():
|
366 |
-
lora_enabled = gr.Checkbox(label='Enable', value=enabled,
|
367 |
-
elem_classes=['lora_enable', 'min_check'], scale=1)
|
368 |
-
lora_model = gr.Dropdown(label=f'LoRA {i + 1}',
|
369 |
-
choices=['None'] + modules.config.lora_filenames, value=filename,
|
370 |
-
elem_classes='lora_model', scale=5)
|
371 |
-
lora_weight = gr.Slider(label='Weight', minimum=modules.config.default_loras_min_weight,
|
372 |
-
maximum=modules.config.default_loras_max_weight, step=0.01, value=weight,
|
373 |
-
elem_classes='lora_weight', scale=5)
|
374 |
-
lora_ctrls += [lora_enabled, lora_model, lora_weight]
|
375 |
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
adm_scaler_end = gr.Slider(label='ADM Guidance End At Step', minimum=0.0, maximum=1.0,
|
395 |
-
step=0.001, value=0.3,
|
396 |
-
info='When to end the guidance from positive/negative ADM. ')
|
397 |
-
|
398 |
-
refiner_swap_method = gr.Dropdown(label='Refiner swap method', value=flags.refiner_swap_method,
|
399 |
-
choices=['joint', 'separate', 'vae'])
|
400 |
-
|
401 |
-
adaptive_cfg = gr.Slider(label='CFG Mimicking from TSNR', minimum=1.0, maximum=30.0, step=0.01,
|
402 |
-
value=modules.config.default_cfg_tsnr,
|
403 |
-
info='Enabling Fooocus\'s implementation of CFG mimicking for TSNR '
|
404 |
-
'(effective when real CFG > mimicked CFG).')
|
405 |
-
sampler_name = gr.Dropdown(label='Sampler', choices=flags.sampler_list,
|
406 |
-
value=modules.config.default_sampler)
|
407 |
-
scheduler_name = gr.Dropdown(label='Scheduler', choices=flags.scheduler_list,
|
408 |
-
value=modules.config.default_scheduler)
|
409 |
-
|
410 |
-
generate_image_grid = gr.Checkbox(label='Generate Image Grid for Each Batch',
|
411 |
-
info='(Experimental) This may cause performance problems on some computers and certain internet conditions.',
|
412 |
-
value=False)
|
413 |
-
|
414 |
-
overwrite_step = gr.Slider(label='Forced Overwrite of Sampling Step',
|
415 |
-
minimum=-1, maximum=200, step=1,
|
416 |
-
value=modules.config.default_overwrite_step,
|
417 |
-
info='Set as -1 to disable. For developer debugging.')
|
418 |
-
overwrite_switch = gr.Slider(label='Forced Overwrite of Refiner Switch Step',
|
419 |
-
minimum=-1, maximum=200, step=1,
|
420 |
-
value=modules.config.default_overwrite_switch,
|
421 |
-
info='Set as -1 to disable. For developer debugging.')
|
422 |
-
overwrite_width = gr.Slider(label='Forced Overwrite of Generating Width',
|
423 |
-
minimum=-1, maximum=2048, step=1, value=-1,
|
424 |
-
info='Set as -1 to disable. For developer debugging. '
|
425 |
-
'Results will be worse for non-standard numbers that SDXL is not trained on.')
|
426 |
-
overwrite_height = gr.Slider(label='Forced Overwrite of Generating Height',
|
427 |
-
minimum=-1, maximum=2048, step=1, value=-1,
|
428 |
-
info='Set as -1 to disable. For developer debugging. '
|
429 |
-
'Results will be worse for non-standard numbers that SDXL is not trained on.')
|
430 |
-
overwrite_vary_strength = gr.Slider(label='Forced Overwrite of Denoising Strength of "Vary"',
|
431 |
-
minimum=-1, maximum=1.0, step=0.001, value=-1,
|
432 |
-
info='Set as negative number to disable. For developer debugging.')
|
433 |
-
overwrite_upscale_strength = gr.Slider(label='Forced Overwrite of Denoising Strength of "Upscale"',
|
434 |
-
minimum=-1, maximum=1.0, step=0.001, value=-1,
|
435 |
-
info='Set as negative number to disable. For developer debugging.')
|
436 |
-
disable_preview = gr.Checkbox(label='Disable Preview', value=False,
|
437 |
-
info='Disable preview during generation.')
|
438 |
-
disable_intermediate_results = gr.Checkbox(label='Disable Intermediate Results',
|
439 |
-
value=modules.config.default_performance == flags.Performance.EXTREME_SPEED.value,
|
440 |
-
interactive=modules.config.default_performance != flags.Performance.EXTREME_SPEED.value,
|
441 |
-
info='Disable intermediate results during generation, only show final gallery.')
|
442 |
-
disable_seed_increment = gr.Checkbox(label='Disable seed increment',
|
443 |
-
info='Disable automatic seed increment when image number is > 1.',
|
444 |
-
value=False)
|
445 |
-
read_wildcards_in_order = gr.Checkbox(label="Read wildcards in order", value=False)
|
446 |
-
|
447 |
-
if not args_manager.args.disable_metadata:
|
448 |
-
save_metadata_to_images = gr.Checkbox(label='Save Metadata to Images', value=modules.config.default_save_metadata_to_images,
|
449 |
-
info='Adds parameters to generated images allowing manual regeneration.')
|
450 |
-
metadata_scheme = gr.Radio(label='Metadata Scheme', choices=flags.metadata_scheme, value=modules.config.default_metadata_scheme,
|
451 |
-
info='Image Prompt parameters are not included. Use png and a1111 for compatibility with Civitai.',
|
452 |
-
visible=modules.config.default_save_metadata_to_images)
|
453 |
-
|
454 |
-
save_metadata_to_images.change(lambda x: gr.update(visible=x), inputs=[save_metadata_to_images], outputs=[metadata_scheme],
|
455 |
-
queue=False, show_progress=False)
|
456 |
-
|
457 |
-
with gr.Tab(label='Control'):
|
458 |
-
debugging_cn_preprocessor = gr.Checkbox(label='Debug Preprocessors', value=False,
|
459 |
-
info='See the results from preprocessors.')
|
460 |
-
skipping_cn_preprocessor = gr.Checkbox(label='Skip Preprocessors', value=False,
|
461 |
-
info='Do not preprocess images. (Inputs are already canny/depth/cropped-face/etc.)')
|
462 |
-
|
463 |
-
mixing_image_prompt_and_vary_upscale = gr.Checkbox(label='Mixing Image Prompt and Vary/Upscale',
|
464 |
-
value=False)
|
465 |
-
mixing_image_prompt_and_inpaint = gr.Checkbox(label='Mixing Image Prompt and Inpaint',
|
466 |
-
value=False)
|
467 |
-
|
468 |
-
controlnet_softness = gr.Slider(label='Softness of ControlNet', minimum=0.0, maximum=1.0,
|
469 |
-
step=0.001, value=0.25,
|
470 |
-
info='Similar to the Control Mode in A1111 (use 0.0 to disable). ')
|
471 |
-
|
472 |
-
with gr.Tab(label='Canny'):
|
473 |
-
canny_low_threshold = gr.Slider(label='Canny Low Threshold', minimum=1, maximum=255,
|
474 |
-
step=1, value=64)
|
475 |
-
canny_high_threshold = gr.Slider(label='Canny High Threshold', minimum=1, maximum=255,
|
476 |
-
step=1, value=128)
|
477 |
-
|
478 |
-
with gr.Tab(label='Inpaint'):
|
479 |
-
debugging_inpaint_preprocessor = gr.Checkbox(label='Debug Inpaint Preprocessing', value=False)
|
480 |
-
inpaint_disable_initial_latent = gr.Checkbox(label='Disable initial latent in inpaint', value=False)
|
481 |
-
inpaint_engine = gr.Dropdown(label='Inpaint Engine',
|
482 |
-
value=modules.config.default_inpaint_engine_version,
|
483 |
-
choices=flags.inpaint_engine_versions,
|
484 |
-
info='Version of Fooocus inpaint model')
|
485 |
-
inpaint_strength = gr.Slider(label='Inpaint Denoising Strength',
|
486 |
-
minimum=0.0, maximum=1.0, step=0.001, value=1.0,
|
487 |
-
info='Same as the denoising strength in A1111 inpaint. '
|
488 |
-
'Only used in inpaint, not used in outpaint. '
|
489 |
-
'(Outpaint always use 1.0)')
|
490 |
-
inpaint_respective_field = gr.Slider(label='Inpaint Respective Field',
|
491 |
-
minimum=0.0, maximum=1.0, step=0.001, value=0.618,
|
492 |
-
info='The area to inpaint. '
|
493 |
-
'Value 0 is same as "Only Masked" in A1111. '
|
494 |
-
'Value 1 is same as "Whole Image" in A1111. '
|
495 |
-
'Only used in inpaint, not used in outpaint. '
|
496 |
-
'(Outpaint always use 1.0)')
|
497 |
-
inpaint_erode_or_dilate = gr.Slider(label='Mask Erode or Dilate',
|
498 |
-
minimum=-64, maximum=64, step=1, value=0,
|
499 |
-
info='Positive value will make white area in the mask larger, '
|
500 |
-
'negative value will make white area smaller.'
|
501 |
-
'(default is 0, always process before any mask invert)')
|
502 |
-
inpaint_mask_upload_checkbox = gr.Checkbox(label='Enable Mask Upload', value=False)
|
503 |
-
invert_mask_checkbox = gr.Checkbox(label='Invert Mask', value=False)
|
504 |
-
|
505 |
-
inpaint_ctrls = [debugging_inpaint_preprocessor, inpaint_disable_initial_latent, inpaint_engine,
|
506 |
-
inpaint_strength, inpaint_respective_field,
|
507 |
-
inpaint_mask_upload_checkbox, invert_mask_checkbox, inpaint_erode_or_dilate]
|
508 |
-
|
509 |
-
inpaint_mask_upload_checkbox.change(lambda x: gr.update(visible=x),
|
510 |
-
inputs=inpaint_mask_upload_checkbox,
|
511 |
-
outputs=inpaint_mask_image, queue=False, show_progress=False)
|
512 |
-
|
513 |
-
with gr.Tab(label='FreeU'):
|
514 |
-
freeu_enabled = gr.Checkbox(label='Enabled', value=False)
|
515 |
-
freeu_b1 = gr.Slider(label='B1', minimum=0, maximum=2, step=0.01, value=1.01)
|
516 |
-
freeu_b2 = gr.Slider(label='B2', minimum=0, maximum=2, step=0.01, value=1.02)
|
517 |
-
freeu_s1 = gr.Slider(label='S1', minimum=0, maximum=4, step=0.01, value=0.99)
|
518 |
-
freeu_s2 = gr.Slider(label='S2', minimum=0, maximum=4, step=0.01, value=0.95)
|
519 |
-
freeu_ctrls = [freeu_enabled, freeu_b1, freeu_b2, freeu_s1, freeu_s2]
|
520 |
-
|
521 |
-
def dev_mode_checked(r):
|
522 |
-
return gr.update(visible=r)
|
523 |
-
|
524 |
-
dev_mode.change(dev_mode_checked, inputs=[dev_mode], outputs=[dev_tools],
|
525 |
-
queue=False, show_progress=False)
|
526 |
-
|
527 |
-
def refresh_files_clicked():
|
528 |
-
modules.config.update_files()
|
529 |
-
results = [gr.update(choices=modules.config.model_filenames)]
|
530 |
-
results += [gr.update(choices=['None'] + modules.config.model_filenames)]
|
531 |
if not args_manager.args.disable_preset_selection:
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
542 |
queue=False, show_progress=False)
|
543 |
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
604 |
|
605 |
-
if mode == modules.flags.inpaint_option_modify:
|
606 |
return [
|
607 |
-
gr.update(visible=
|
608 |
gr.Dataset.update(visible=False, samples=modules.config.example_inpaint_prompts),
|
609 |
-
|
610 |
]
|
611 |
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
616 |
]
|
617 |
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
if
|
657 |
-
|
|
|
658 |
else:
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
gr.Audio(interactive=False, value=notification_file, elem_id='audio_notification', visible=False)
|
694 |
-
break
|
695 |
-
|
696 |
-
def trigger_describe(mode, img):
|
697 |
-
if mode == flags.desc_type_photo:
|
698 |
-
from extras.interrogate import default_interrogator as default_interrogator_photo
|
699 |
-
return default_interrogator_photo(img), ["Fooocus V2", "Fooocus Enhance", "Fooocus Sharp"]
|
700 |
-
if mode == flags.desc_type_anime:
|
701 |
-
from extras.wd14tagger import default_interrogator as default_interrogator_anime
|
702 |
-
return default_interrogator_anime(img), ["Fooocus V2", "Fooocus Masterpiece"]
|
703 |
-
return mode, ["Fooocus V2"]
|
704 |
-
|
705 |
-
desc_btn.click(trigger_describe, inputs=[desc_method, desc_input_image],
|
706 |
-
outputs=[prompt, style_selections], show_progress=True, queue=True)
|
707 |
|
708 |
|
709 |
def dump_default_english_config():
|
|
|
16 |
import args_manager
|
17 |
import copy
|
18 |
import launch
|
19 |
+
import torch
|
20 |
|
21 |
from modules.sdxl_styles import legal_style_names
|
22 |
from modules.private_logger import get_current_html_path
|
|
|
24 |
from modules.auth import auth_enabled, check_auth
|
25 |
from modules.util import is_json
|
26 |
|
27 |
+
def ini_args():
|
28 |
+
from args_manager import args
|
29 |
+
return args
|
30 |
+
|
31 |
+
if ini_args().api_mode:
|
32 |
+
import dummy_inference as inf
|
33 |
+
else:
|
34 |
+
import inference as inf
|
35 |
+
|
36 |
def get_task(*args):
|
37 |
args = list(args)
|
38 |
args.pop(0)
|
|
|
106 |
if isinstance(args_manager.args.preset, str):
|
107 |
title += ' ' + args_manager.args.preset
|
108 |
|
109 |
+
theme = gr.themes.Soft()
|
110 |
+
|
111 |
+
shared.gradio_root = gr.Blocks(title=title, theme=theme).queue()
|
112 |
+
|
113 |
+
if torch.cuda.is_available():
|
114 |
+
power_device = "GPU"
|
115 |
+
else:
|
116 |
+
power_device = "CPU"
|
117 |
|
118 |
with shared.gradio_root:
|
119 |
+
gr.Markdown(f"""# <center>zStudios Generative Media AI running on {power_device}</center>""")
|
120 |
+
with gr.Tab("DALL-E"):
|
121 |
+
with gr.Row(variant="panel"):
|
122 |
+
model = gr.Dropdown(choices=["dall-e-2", "dall-e-3"], label="Model", value="dall-e-3")
|
123 |
+
quality = gr.Dropdown(choices=["standard", "hd"], label="Quality", value="standard")
|
124 |
+
size = gr.Dropdown(choices=["256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"], label="Size",
|
125 |
+
value="1024x1024")
|
126 |
+
|
127 |
+
dalleText = gr.Textbox(label="Prompt",
|
128 |
+
placeholder="Enter your text and then click on the \"Run\" button, "
|
129 |
+
"or simply press the Enter key.")
|
130 |
+
dalleBtn = gr.Button("Run")
|
131 |
+
output_image = gr.Image(label="Image Output")
|
132 |
+
|
133 |
+
dalleText.submit(fn=inf.infer_dall_e, inputs=[dalleText, model, quality, size], outputs=output_image, api_name="infer_dall_e")
|
134 |
+
dalleBtn.click(fn=inf.infer_dall_e, inputs=[dalleText, model, quality, size], outputs=output_image, api_name=False)
|
135 |
+
|
136 |
+
with gr.Tab("Fooocus"):
|
137 |
+
args = ini_args()
|
138 |
+
if args.api_mode:
|
139 |
+
gr.Markdown("Deactivated")
|
140 |
+
currentTask = gr.State(worker.AsyncTask(args=[]))
|
141 |
+
with gr.Row():
|
142 |
+
with gr.Column(scale=2):
|
143 |
+
with gr.Row():
|
144 |
+
progress_window = grh.Image(label='Preview', show_label=True, visible=False, height=768,
|
145 |
+
elem_classes=['main_view'])
|
146 |
+
progress_gallery = gr.Gallery(label='Finished Images', show_label=True, object_fit='contain',
|
147 |
+
height=768, visible=False, elem_classes=['main_view', 'image_gallery'])
|
148 |
+
progress_html = gr.HTML(value=modules.html.make_progress_html(32, 'Progress 32%'), visible=False,
|
149 |
+
elem_id='progress-bar', elem_classes='progress-bar')
|
150 |
+
gallery = gr.Gallery(label='Gallery', show_label=False, object_fit='contain', visible=True, height=768,
|
151 |
+
elem_classes=['resizable_area', 'main_view', 'final_gallery', 'image_gallery'],
|
152 |
+
elem_id='final_gallery')
|
153 |
+
with gr.Row(elem_classes='type_row'):
|
154 |
+
with gr.Column(scale=17):
|
155 |
+
prompt = gr.Textbox(show_label=False, placeholder="Type prompt here or paste parameters.", elem_id='positive_prompt',
|
156 |
+
container=False, autofocus=True, elem_classes='type_row', lines=1024)
|
157 |
+
|
158 |
+
default_prompt = modules.config.default_prompt
|
159 |
+
if isinstance(default_prompt, str) and default_prompt != '':
|
160 |
+
shared.gradio_root.load(lambda: default_prompt, outputs=prompt)
|
161 |
+
|
162 |
+
with gr.Column(scale=3, min_width=0):
|
163 |
+
generate_button = gr.Button(label="Generate", value="Generate", elem_classes='type_row', elem_id='generate_button', visible=True)
|
164 |
+
load_parameter_button = gr.Button(label="Load Parameters", value="Load Parameters", elem_classes='type_row', elem_id='load_parameter_button', visible=False)
|
165 |
+
skip_button = gr.Button(label="Skip", value="Skip", elem_classes='type_row_half', visible=False)
|
166 |
+
stop_button = gr.Button(label="Stop", value="Stop", elem_classes='type_row_half', elem_id='stop_button', visible=False)
|
167 |
+
|
168 |
+
def stop_clicked(currentTask):
|
169 |
+
import ldm_patched.modules.model_management as model_management
|
170 |
+
currentTask.last_stop = 'stop'
|
171 |
+
if (currentTask.processing):
|
172 |
+
model_management.interrupt_current_processing()
|
173 |
+
return currentTask
|
174 |
+
|
175 |
+
def skip_clicked(currentTask):
|
176 |
+
import ldm_patched.modules.model_management as model_management
|
177 |
+
currentTask.last_stop = 'skip'
|
178 |
+
if (currentTask.processing):
|
179 |
+
model_management.interrupt_current_processing()
|
180 |
+
return currentTask
|
181 |
+
|
182 |
+
stop_button.click(stop_clicked, inputs=currentTask, outputs=currentTask, queue=False, show_progress=False, _js='cancelGenerateForever')
|
183 |
+
skip_button.click(skip_clicked, inputs=currentTask, outputs=currentTask, queue=False, show_progress=False)
|
184 |
+
with gr.Row(elem_classes='advanced_check_row'):
|
185 |
+
input_image_checkbox = gr.Checkbox(label='Input Image', value=False, container=False, elem_classes='min_check')
|
186 |
+
advanced_checkbox = gr.Checkbox(label='Advanced', value=modules.config.default_advanced_checkbox, container=False, elem_classes='min_check')
|
187 |
+
with gr.Row(visible=False) as image_input_panel:
|
188 |
+
with gr.Tabs():
|
189 |
+
with gr.TabItem(label='Upscale or Variation') as uov_tab:
|
190 |
+
with gr.Row():
|
191 |
with gr.Column():
|
192 |
+
uov_input_image = grh.Image(label='Drag above image to here', source='upload', type='numpy')
|
193 |
+
with gr.Column():
|
194 |
+
uov_method = gr.Radio(label='Upscale or Variation:', choices=flags.uov_list, value=flags.disabled)
|
195 |
+
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/390" target="_blank">\U0001F4D4 Document</a>')
|
196 |
+
with gr.TabItem(label='Image Prompt') as ip_tab:
|
197 |
+
with gr.Row():
|
198 |
+
ip_images = []
|
199 |
+
ip_types = []
|
200 |
+
ip_stops = []
|
201 |
+
ip_weights = []
|
202 |
+
ip_ctrls = []
|
203 |
+
ip_ad_cols = []
|
204 |
+
for _ in range(flags.controlnet_image_count):
|
205 |
+
with gr.Column():
|
206 |
+
ip_image = grh.Image(label='Image', source='upload', type='numpy', show_label=False, height=300)
|
207 |
+
ip_images.append(ip_image)
|
208 |
+
ip_ctrls.append(ip_image)
|
209 |
+
with gr.Column(visible=False) as ad_col:
|
210 |
+
with gr.Row():
|
211 |
+
default_end, default_weight = flags.default_parameters[flags.default_ip]
|
212 |
+
|
213 |
+
ip_stop = gr.Slider(label='Stop At', minimum=0.0, maximum=1.0, step=0.001, value=default_end)
|
214 |
+
ip_stops.append(ip_stop)
|
215 |
+
ip_ctrls.append(ip_stop)
|
216 |
+
|
217 |
+
ip_weight = gr.Slider(label='Weight', minimum=0.0, maximum=2.0, step=0.001, value=default_weight)
|
218 |
+
ip_weights.append(ip_weight)
|
219 |
+
ip_ctrls.append(ip_weight)
|
220 |
+
|
221 |
+
ip_type = gr.Radio(label='Type', choices=flags.ip_list, value=flags.default_ip, container=False)
|
222 |
+
ip_types.append(ip_type)
|
223 |
+
ip_ctrls.append(ip_type)
|
224 |
+
|
225 |
+
ip_type.change(lambda x: flags.default_parameters[x], inputs=[ip_type], outputs=[ip_stop, ip_weight], queue=False, show_progress=False)
|
226 |
+
ip_ad_cols.append(ad_col)
|
227 |
+
ip_advanced = gr.Checkbox(label='Advanced', value=False, container=False)
|
228 |
+
gr.HTML('* \"Image Prompt\" is powered by Fooocus Image Mixture Engine (v1.0.1). <a href="https://github.com/lllyasviel/Fooocus/discussions/557" target="_blank">\U0001F4D4 Document</a>')
|
229 |
+
|
230 |
+
def ip_advance_checked(x):
|
231 |
+
return [gr.update(visible=x)] * len(ip_ad_cols) + \
|
232 |
+
[flags.default_ip] * len(ip_types) + \
|
233 |
+
[flags.default_parameters[flags.default_ip][0]] * len(ip_stops) + \
|
234 |
+
[flags.default_parameters[flags.default_ip][1]] * len(ip_weights)
|
235 |
+
|
236 |
+
ip_advanced.change(ip_advance_checked, inputs=ip_advanced,
|
237 |
+
outputs=ip_ad_cols + ip_types + ip_stops + ip_weights,
|
238 |
+
queue=False, show_progress=False)
|
239 |
+
with gr.TabItem(label='Inpaint or Outpaint') as inpaint_tab:
|
240 |
+
with gr.Row():
|
241 |
+
inpaint_input_image = grh.Image(label='Drag inpaint or outpaint image to here', source='upload', type='numpy', tool='sketch', height=500, brush_color="#FFFFFF", elem_id='inpaint_canvas')
|
242 |
+
inpaint_mask_image = grh.Image(label='Mask Upload', source='upload', type='numpy', height=500, visible=False)
|
243 |
+
|
244 |
+
with gr.Row():
|
245 |
+
inpaint_additional_prompt = gr.Textbox(placeholder="Describe what you want to inpaint.", elem_id='inpaint_additional_prompt', label='Inpaint Additional Prompt', visible=False)
|
246 |
+
outpaint_selections = gr.CheckboxGroup(choices=['Left', 'Right', 'Top', 'Bottom'], value=[], label='Outpaint Direction')
|
247 |
+
inpaint_mode = gr.Dropdown(choices=modules.flags.inpaint_options, value=modules.flags.inpaint_option_default, label='Method')
|
248 |
+
example_inpaint_prompts = gr.Dataset(samples=modules.config.example_inpaint_prompts, label='Additional Prompt Quick List', components=[inpaint_additional_prompt], visible=False)
|
249 |
+
gr.HTML('* Powered by Fooocus Inpaint Engine <a href="https://github.com/lllyasviel/Fooocus/discussions/414" target="_blank">\U0001F4D4 Document</a>')
|
250 |
+
example_inpaint_prompts.click(lambda x: x[0], inputs=example_inpaint_prompts, outputs=inpaint_additional_prompt, show_progress=False, queue=False)
|
251 |
+
with gr.TabItem(label='Describe') as desc_tab:
|
252 |
+
with gr.Row():
|
253 |
+
with gr.Column():
|
254 |
+
desc_input_image = grh.Image(label='Drag any image to here', source='upload', type='numpy')
|
255 |
+
with gr.Column():
|
256 |
+
desc_method = gr.Radio(
|
257 |
+
label='Content Type',
|
258 |
+
choices=[flags.desc_type_photo, flags.desc_type_anime],
|
259 |
+
value=flags.desc_type_photo)
|
260 |
+
desc_btn = gr.Button(value='Describe this Image into Prompt')
|
261 |
+
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/1363" target="_blank">\U0001F4D4 Document</a>')
|
262 |
+
with gr.TabItem(label='Metadata') as load_tab:
|
263 |
with gr.Column():
|
264 |
+
metadata_input_image = grh.Image(label='Drag any image generated by Fooocus here', source='upload', type='filepath')
|
265 |
+
metadata_json = gr.JSON(label='Metadata')
|
266 |
+
metadata_import_button = gr.Button(value='Apply Metadata')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
|
268 |
+
def trigger_metadata_preview(filepath):
|
269 |
+
parameters, metadata_scheme = modules.meta_parser.read_info_from_image(filepath)
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
+
results = {}
|
272 |
+
if parameters is not None:
|
273 |
+
results['parameters'] = parameters
|
274 |
|
275 |
+
if isinstance(metadata_scheme, flags.MetadataScheme):
|
276 |
+
results['metadata_scheme'] = metadata_scheme.value
|
277 |
|
278 |
+
return results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
|
280 |
+
metadata_input_image.upload(trigger_metadata_preview, inputs=metadata_input_image,
|
281 |
+
outputs=metadata_json, queue=False, show_progress=True)
|
282 |
+
|
283 |
+
switch_js = "(x) => {if(x){viewer_to_bottom(100);viewer_to_bottom(500);}else{viewer_to_top();} return x;}"
|
284 |
+
down_js = "() => {viewer_to_bottom();}"
|
285 |
+
|
286 |
+
input_image_checkbox.change(lambda x: gr.update(visible=x), inputs=input_image_checkbox,
|
287 |
+
outputs=image_input_panel, queue=False, show_progress=False, _js=switch_js)
|
288 |
+
ip_advanced.change(lambda: None, queue=False, show_progress=False, _js=down_js)
|
289 |
+
|
290 |
+
current_tab = gr.Textbox(value='uov', visible=False)
|
291 |
+
uov_tab.select(lambda: 'uov', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
292 |
+
inpaint_tab.select(lambda: 'inpaint', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
293 |
+
ip_tab.select(lambda: 'ip', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
294 |
+
desc_tab.select(lambda: 'desc', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
295 |
+
|
296 |
+
with gr.Column(scale=1, visible=modules.config.default_advanced_checkbox) as advanced_column:
|
297 |
+
with gr.Tab(label='Setting'):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
if not args_manager.args.disable_preset_selection:
|
299 |
+
preset_selection = gr.Radio(label='Preset',
|
300 |
+
choices=modules.config.available_presets,
|
301 |
+
value=args_manager.args.preset if args_manager.args.preset else "initial",
|
302 |
+
interactive=True)
|
303 |
+
performance_selection = gr.Radio(label='Performance',
|
304 |
+
choices=flags.Performance.list(),
|
305 |
+
value=modules.config.default_performance)
|
306 |
+
aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=modules.config.available_aspect_ratios,
|
307 |
+
value=modules.config.default_aspect_ratio, info='width × height',
|
308 |
+
elem_classes='aspect_ratios')
|
309 |
+
image_number = gr.Slider(label='Image Number', minimum=1, maximum=modules.config.default_max_image_number, step=1, value=modules.config.default_image_number)
|
310 |
+
|
311 |
+
output_format = gr.Radio(label='Output Format',
|
312 |
+
choices=flags.OutputFormat.list(),
|
313 |
+
value=modules.config.default_output_format)
|
314 |
+
|
315 |
+
negative_prompt = gr.Textbox(label='Negative Prompt', show_label=True, placeholder="Type prompt here.",
|
316 |
+
info='Describing what you do not want to see.', lines=2,
|
317 |
+
elem_id='negative_prompt',
|
318 |
+
value=modules.config.default_prompt_negative)
|
319 |
+
seed_random = gr.Checkbox(label='Random', value=True)
|
320 |
+
image_seed = gr.Textbox(label='Seed', value=0, max_lines=1, visible=False) # workaround for https://github.com/gradio-app/gradio/issues/5354
|
321 |
+
|
322 |
+
def random_checked(r):
|
323 |
+
return gr.update(visible=not r)
|
324 |
+
|
325 |
+
def refresh_seed(r, seed_string):
|
326 |
+
if r:
|
327 |
+
return random.randint(constants.MIN_SEED, constants.MAX_SEED)
|
328 |
+
else:
|
329 |
+
try:
|
330 |
+
seed_value = int(seed_string)
|
331 |
+
if constants.MIN_SEED <= seed_value <= constants.MAX_SEED:
|
332 |
+
return seed_value
|
333 |
+
except ValueError:
|
334 |
+
pass
|
335 |
+
return random.randint(constants.MIN_SEED, constants.MAX_SEED)
|
336 |
+
|
337 |
+
seed_random.change(random_checked, inputs=[seed_random], outputs=[image_seed],
|
338 |
queue=False, show_progress=False)
|
339 |
|
340 |
+
def update_history_link():
|
341 |
+
if args_manager.args.disable_image_log:
|
342 |
+
return gr.update(value='')
|
343 |
+
|
344 |
+
return gr.update(value=f'<a href="file={get_current_html_path(output_format)}" target="_blank">\U0001F4DA History Log</a>')
|
345 |
+
|
346 |
+
history_link = gr.HTML()
|
347 |
+
shared.gradio_root.load(update_history_link, outputs=history_link, queue=False, show_progress=False)
|
348 |
+
|
349 |
+
with gr.Tab(label='Style', elem_classes=['style_selections_tab']):
|
350 |
+
style_sorter.try_load_sorted_styles(
|
351 |
+
style_names=legal_style_names,
|
352 |
+
default_selected=modules.config.default_styles)
|
353 |
+
|
354 |
+
style_search_bar = gr.Textbox(show_label=False, container=False,
|
355 |
+
placeholder="\U0001F50E Type here to search styles ...",
|
356 |
+
value="",
|
357 |
+
label='Search Styles')
|
358 |
+
style_selections = gr.CheckboxGroup(show_label=False, container=False,
|
359 |
+
choices=copy.deepcopy(style_sorter.all_styles),
|
360 |
+
value=copy.deepcopy(modules.config.default_styles),
|
361 |
+
label='Selected Styles',
|
362 |
+
elem_classes=['style_selections'])
|
363 |
+
gradio_receiver_style_selections = gr.Textbox(elem_id='gradio_receiver_style_selections', visible=False)
|
364 |
+
|
365 |
+
shared.gradio_root.load(lambda: gr.update(choices=copy.deepcopy(style_sorter.all_styles)),
|
366 |
+
outputs=style_selections)
|
367 |
+
|
368 |
+
style_search_bar.change(style_sorter.search_styles,
|
369 |
+
inputs=[style_selections, style_search_bar],
|
370 |
+
outputs=style_selections,
|
371 |
+
queue=False,
|
372 |
+
show_progress=False).then(
|
373 |
+
lambda: None, _js='()=>{refresh_style_localization();}')
|
374 |
+
|
375 |
+
gradio_receiver_style_selections.input(style_sorter.sort_styles,
|
376 |
+
inputs=style_selections,
|
377 |
+
outputs=style_selections,
|
378 |
+
queue=False,
|
379 |
+
show_progress=False).then(
|
380 |
+
lambda: None, _js='()=>{refresh_style_localization();}')
|
381 |
+
|
382 |
+
with gr.Tab(label='Model'):
|
383 |
+
with gr.Group():
|
384 |
+
with gr.Row():
|
385 |
+
base_model = gr.Dropdown(label='Base Model (SDXL only)', choices=modules.config.model_filenames, value=modules.config.default_base_model_name, show_label=True)
|
386 |
+
refiner_model = gr.Dropdown(label='Refiner (SDXL or SD 1.5)', choices=['None'] + modules.config.model_filenames, value=modules.config.default_refiner_model_name, show_label=True)
|
387 |
+
|
388 |
+
refiner_switch = gr.Slider(label='Refiner Switch At', minimum=0.1, maximum=1.0, step=0.0001,
|
389 |
+
info='Use 0.4 for SD1.5 realistic models; '
|
390 |
+
'or 0.667 for SD1.5 anime models; '
|
391 |
+
'or 0.8 for XL-refiners; '
|
392 |
+
'or any value for switching two SDXL models.',
|
393 |
+
value=modules.config.default_refiner_switch,
|
394 |
+
visible=modules.config.default_refiner_model_name != 'None')
|
395 |
+
|
396 |
+
refiner_model.change(lambda x: gr.update(visible=x != 'None'),
|
397 |
+
inputs=refiner_model, outputs=refiner_switch, show_progress=False, queue=False)
|
398 |
+
|
399 |
+
with gr.Group():
|
400 |
+
lora_ctrls = []
|
401 |
+
|
402 |
+
for i, (enabled, filename, weight) in enumerate(modules.config.default_loras):
|
403 |
+
with gr.Row():
|
404 |
+
lora_enabled = gr.Checkbox(label='Enable', value=enabled,
|
405 |
+
elem_classes=['lora_enable', 'min_check'], scale=1)
|
406 |
+
lora_model = gr.Dropdown(label=f'LoRA {i + 1}',
|
407 |
+
choices=['None'] + modules.config.lora_filenames, value=filename,
|
408 |
+
elem_classes='lora_model', scale=5)
|
409 |
+
lora_weight = gr.Slider(label='Weight', minimum=modules.config.default_loras_min_weight,
|
410 |
+
maximum=modules.config.default_loras_max_weight, step=0.01, value=weight,
|
411 |
+
elem_classes='lora_weight', scale=5)
|
412 |
+
lora_ctrls += [lora_enabled, lora_model, lora_weight]
|
413 |
+
|
414 |
+
with gr.Row():
|
415 |
+
refresh_files = gr.Button(label='Refresh', value='\U0001f504 Refresh All Files', variant='secondary', elem_classes='refresh_button')
|
416 |
+
with gr.Tab(label='Advanced'):
|
417 |
+
guidance_scale = gr.Slider(label='Guidance Scale', minimum=1.0, maximum=30.0, step=0.01,
|
418 |
+
value=modules.config.default_cfg_scale,
|
419 |
+
info='Higher value means style is cleaner, vivider, and more artistic.')
|
420 |
+
sharpness = gr.Slider(label='Image Sharpness', minimum=0.0, maximum=30.0, step=0.001,
|
421 |
+
value=modules.config.default_sample_sharpness,
|
422 |
+
info='Higher value means image and texture are sharper.')
|
423 |
+
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/117" target="_blank">\U0001F4D4 Document</a>')
|
424 |
+
dev_mode = gr.Checkbox(label='Developer Debug Mode', value=False, container=False)
|
425 |
+
|
426 |
+
with gr.Column(visible=False) as dev_tools:
|
427 |
+
with gr.Tab(label='Debug Tools'):
|
428 |
+
adm_scaler_positive = gr.Slider(label='Positive ADM Guidance Scaler', minimum=0.1, maximum=3.0,
|
429 |
+
step=0.001, value=1.5, info='The scaler multiplied to positive ADM (use 1.0 to disable). ')
|
430 |
+
adm_scaler_negative = gr.Slider(label='Negative ADM Guidance Scaler', minimum=0.1, maximum=3.0,
|
431 |
+
step=0.001, value=0.8, info='The scaler multiplied to negative ADM (use 1.0 to disable). ')
|
432 |
+
adm_scaler_end = gr.Slider(label='ADM Guidance End At Step', minimum=0.0, maximum=1.0,
|
433 |
+
step=0.001, value=0.3,
|
434 |
+
info='When to end the guidance from positive/negative ADM. ')
|
435 |
+
|
436 |
+
refiner_swap_method = gr.Dropdown(label='Refiner swap method', value=flags.refiner_swap_method,
|
437 |
+
choices=['joint', 'separate', 'vae'])
|
438 |
+
|
439 |
+
adaptive_cfg = gr.Slider(label='CFG Mimicking from TSNR', minimum=1.0, maximum=30.0, step=0.01,
|
440 |
+
value=modules.config.default_cfg_tsnr,
|
441 |
+
info='Enabling Fooocus\'s implementation of CFG mimicking for TSNR '
|
442 |
+
'(effective when real CFG > mimicked CFG).')
|
443 |
+
sampler_name = gr.Dropdown(label='Sampler', choices=flags.sampler_list,
|
444 |
+
value=modules.config.default_sampler)
|
445 |
+
scheduler_name = gr.Dropdown(label='Scheduler', choices=flags.scheduler_list,
|
446 |
+
value=modules.config.default_scheduler)
|
447 |
+
|
448 |
+
generate_image_grid = gr.Checkbox(label='Generate Image Grid for Each Batch',
|
449 |
+
info='(Experimental) This may cause performance problems on some computers and certain internet conditions.',
|
450 |
+
value=False)
|
451 |
+
|
452 |
+
overwrite_step = gr.Slider(label='Forced Overwrite of Sampling Step',
|
453 |
+
minimum=-1, maximum=200, step=1,
|
454 |
+
value=modules.config.default_overwrite_step,
|
455 |
+
info='Set as -1 to disable. For developer debugging.')
|
456 |
+
overwrite_switch = gr.Slider(label='Forced Overwrite of Refiner Switch Step',
|
457 |
+
minimum=-1, maximum=200, step=1,
|
458 |
+
value=modules.config.default_overwrite_switch,
|
459 |
+
info='Set as -1 to disable. For developer debugging.')
|
460 |
+
overwrite_width = gr.Slider(label='Forced Overwrite of Generating Width',
|
461 |
+
minimum=-1, maximum=2048, step=1, value=-1,
|
462 |
+
info='Set as -1 to disable. For developer debugging. '
|
463 |
+
'Results will be worse for non-standard numbers that SDXL is not trained on.')
|
464 |
+
overwrite_height = gr.Slider(label='Forced Overwrite of Generating Height',
|
465 |
+
minimum=-1, maximum=2048, step=1, value=-1,
|
466 |
+
info='Set as -1 to disable. For developer debugging. '
|
467 |
+
'Results will be worse for non-standard numbers that SDXL is not trained on.')
|
468 |
+
overwrite_vary_strength = gr.Slider(label='Forced Overwrite of Denoising Strength of "Vary"',
|
469 |
+
minimum=-1, maximum=1.0, step=0.001, value=-1,
|
470 |
+
info='Set as negative number to disable. For developer debugging.')
|
471 |
+
overwrite_upscale_strength = gr.Slider(label='Forced Overwrite of Denoising Strength of "Upscale"',
|
472 |
+
minimum=-1, maximum=1.0, step=0.001, value=-1,
|
473 |
+
info='Set as negative number to disable. For developer debugging.')
|
474 |
+
disable_preview = gr.Checkbox(label='Disable Preview', value=False,
|
475 |
+
info='Disable preview during generation.')
|
476 |
+
disable_intermediate_results = gr.Checkbox(label='Disable Intermediate Results',
|
477 |
+
value=modules.config.default_performance == flags.Performance.EXTREME_SPEED.value,
|
478 |
+
interactive=modules.config.default_performance != flags.Performance.EXTREME_SPEED.value,
|
479 |
+
info='Disable intermediate results during generation, only show final gallery.')
|
480 |
+
disable_seed_increment = gr.Checkbox(label='Disable seed increment',
|
481 |
+
info='Disable automatic seed increment when image number is > 1.',
|
482 |
+
value=False)
|
483 |
+
read_wildcards_in_order = gr.Checkbox(label="Read wildcards in order", value=False)
|
484 |
+
|
485 |
+
if not args_manager.args.disable_metadata:
|
486 |
+
save_metadata_to_images = gr.Checkbox(label='Save Metadata to Images', value=modules.config.default_save_metadata_to_images,
|
487 |
+
info='Adds parameters to generated images allowing manual regeneration.')
|
488 |
+
metadata_scheme = gr.Radio(label='Metadata Scheme', choices=flags.metadata_scheme, value=modules.config.default_metadata_scheme,
|
489 |
+
info='Image Prompt parameters are not included. Use png and a1111 for compatibility with Civitai.',
|
490 |
+
visible=modules.config.default_save_metadata_to_images)
|
491 |
+
|
492 |
+
save_metadata_to_images.change(lambda x: gr.update(visible=x), inputs=[save_metadata_to_images], outputs=[metadata_scheme],
|
493 |
+
queue=False, show_progress=False)
|
494 |
+
|
495 |
+
with gr.Tab(label='Control'):
|
496 |
+
debugging_cn_preprocessor = gr.Checkbox(label='Debug Preprocessors', value=False,
|
497 |
+
info='See the results from preprocessors.')
|
498 |
+
skipping_cn_preprocessor = gr.Checkbox(label='Skip Preprocessors', value=False,
|
499 |
+
info='Do not preprocess images. (Inputs are already canny/depth/cropped-face/etc.)')
|
500 |
+
|
501 |
+
mixing_image_prompt_and_vary_upscale = gr.Checkbox(label='Mixing Image Prompt and Vary/Upscale',
|
502 |
+
value=False)
|
503 |
+
mixing_image_prompt_and_inpaint = gr.Checkbox(label='Mixing Image Prompt and Inpaint',
|
504 |
+
value=False)
|
505 |
+
|
506 |
+
controlnet_softness = gr.Slider(label='Softness of ControlNet', minimum=0.0, maximum=1.0,
|
507 |
+
step=0.001, value=0.25,
|
508 |
+
info='Similar to the Control Mode in A1111 (use 0.0 to disable). ')
|
509 |
+
|
510 |
+
with gr.Tab(label='Canny'):
|
511 |
+
canny_low_threshold = gr.Slider(label='Canny Low Threshold', minimum=1, maximum=255,
|
512 |
+
step=1, value=64)
|
513 |
+
canny_high_threshold = gr.Slider(label='Canny High Threshold', minimum=1, maximum=255,
|
514 |
+
step=1, value=128)
|
515 |
+
|
516 |
+
with gr.Tab(label='Inpaint'):
|
517 |
+
debugging_inpaint_preprocessor = gr.Checkbox(label='Debug Inpaint Preprocessing', value=False)
|
518 |
+
inpaint_disable_initial_latent = gr.Checkbox(label='Disable initial latent in inpaint', value=False)
|
519 |
+
inpaint_engine = gr.Dropdown(label='Inpaint Engine',
|
520 |
+
value=modules.config.default_inpaint_engine_version,
|
521 |
+
choices=flags.inpaint_engine_versions,
|
522 |
+
info='Version of Fooocus inpaint model')
|
523 |
+
inpaint_strength = gr.Slider(label='Inpaint Denoising Strength',
|
524 |
+
minimum=0.0, maximum=1.0, step=0.001, value=1.0,
|
525 |
+
info='Same as the denoising strength in A1111 inpaint. '
|
526 |
+
'Only used in inpaint, not used in outpaint. '
|
527 |
+
'(Outpaint always use 1.0)')
|
528 |
+
inpaint_respective_field = gr.Slider(label='Inpaint Respective Field',
|
529 |
+
minimum=0.0, maximum=1.0, step=0.001, value=0.618,
|
530 |
+
info='The area to inpaint. '
|
531 |
+
'Value 0 is same as "Only Masked" in A1111. '
|
532 |
+
'Value 1 is same as "Whole Image" in A1111. '
|
533 |
+
'Only used in inpaint, not used in outpaint. '
|
534 |
+
'(Outpaint always use 1.0)')
|
535 |
+
inpaint_erode_or_dilate = gr.Slider(label='Mask Erode or Dilate',
|
536 |
+
minimum=-64, maximum=64, step=1, value=0,
|
537 |
+
info='Positive value will make white area in the mask larger, '
|
538 |
+
'negative value will make white area smaller.'
|
539 |
+
'(default is 0, always process before any mask invert)')
|
540 |
+
inpaint_mask_upload_checkbox = gr.Checkbox(label='Enable Mask Upload', value=False)
|
541 |
+
invert_mask_checkbox = gr.Checkbox(label='Invert Mask', value=False)
|
542 |
+
|
543 |
+
inpaint_ctrls = [debugging_inpaint_preprocessor, inpaint_disable_initial_latent, inpaint_engine,
|
544 |
+
inpaint_strength, inpaint_respective_field,
|
545 |
+
inpaint_mask_upload_checkbox, invert_mask_checkbox, inpaint_erode_or_dilate]
|
546 |
+
|
547 |
+
inpaint_mask_upload_checkbox.change(lambda x: gr.update(visible=x),
|
548 |
+
inputs=inpaint_mask_upload_checkbox,
|
549 |
+
outputs=inpaint_mask_image, queue=False, show_progress=False)
|
550 |
+
|
551 |
+
with gr.Tab(label='FreeU'):
|
552 |
+
freeu_enabled = gr.Checkbox(label='Enabled', value=False)
|
553 |
+
freeu_b1 = gr.Slider(label='B1', minimum=0, maximum=2, step=0.01, value=1.01)
|
554 |
+
freeu_b2 = gr.Slider(label='B2', minimum=0, maximum=2, step=0.01, value=1.02)
|
555 |
+
freeu_s1 = gr.Slider(label='S1', minimum=0, maximum=4, step=0.01, value=0.99)
|
556 |
+
freeu_s2 = gr.Slider(label='S2', minimum=0, maximum=4, step=0.01, value=0.95)
|
557 |
+
freeu_ctrls = [freeu_enabled, freeu_b1, freeu_b2, freeu_s1, freeu_s2]
|
558 |
+
|
559 |
+
def dev_mode_checked(r):
|
560 |
+
return gr.update(visible=r)
|
561 |
+
|
562 |
+
dev_mode.change(dev_mode_checked, inputs=[dev_mode], outputs=[dev_tools],
|
563 |
+
queue=False, show_progress=False)
|
564 |
+
|
565 |
+
def refresh_files_clicked():
|
566 |
+
modules.config.update_files()
|
567 |
+
results = [gr.update(choices=modules.config.model_filenames)]
|
568 |
+
results += [gr.update(choices=['None'] + modules.config.model_filenames)]
|
569 |
+
if not args_manager.args.disable_preset_selection:
|
570 |
+
results += [gr.update(choices=modules.config.available_presets)]
|
571 |
+
for i in range(modules.config.default_max_lora_number):
|
572 |
+
results += [gr.update(interactive=True),
|
573 |
+
gr.update(choices=['None'] + modules.config.lora_filenames), gr.update()]
|
574 |
+
return results
|
575 |
+
|
576 |
+
refresh_files_output = [base_model, refiner_model]
|
577 |
+
if not args_manager.args.disable_preset_selection:
|
578 |
+
refresh_files_output += [preset_selection]
|
579 |
+
refresh_files.click(refresh_files_clicked, [], refresh_files_output + lora_ctrls,
|
580 |
+
queue=False, show_progress=False)
|
581 |
+
|
582 |
+
state_is_generating = gr.State(False)
|
583 |
+
|
584 |
+
load_data_outputs = [advanced_checkbox, image_number, prompt, negative_prompt, style_selections,
|
585 |
+
performance_selection, overwrite_step, overwrite_switch, aspect_ratios_selection,
|
586 |
+
overwrite_width, overwrite_height, guidance_scale, sharpness, adm_scaler_positive,
|
587 |
+
adm_scaler_negative, adm_scaler_end, refiner_swap_method, adaptive_cfg, base_model,
|
588 |
+
refiner_model, refiner_switch, sampler_name, scheduler_name, seed_random, image_seed,
|
589 |
+
generate_button, load_parameter_button] + freeu_ctrls + lora_ctrls
|
590 |
+
|
591 |
+
if not args_manager.args.disable_preset_selection:
|
592 |
+
def preset_selection_change(preset, is_generating):
|
593 |
+
preset_content = modules.config.try_get_preset_content(preset) if preset != 'initial' else {}
|
594 |
+
preset_prepared = modules.meta_parser.parse_meta_from_preset(preset_content)
|
595 |
+
|
596 |
+
default_model = preset_prepared.get('base_model')
|
597 |
+
previous_default_models = preset_prepared.get('previous_default_models', [])
|
598 |
+
checkpoint_downloads = preset_prepared.get('checkpoint_downloads', {})
|
599 |
+
embeddings_downloads = preset_prepared.get('embeddings_downloads', {})
|
600 |
+
lora_downloads = preset_prepared.get('lora_downloads', {})
|
601 |
+
|
602 |
+
preset_prepared['base_model'], preset_prepared['lora_downloads'] = launch.download_models(
|
603 |
+
default_model, previous_default_models, checkpoint_downloads, embeddings_downloads, lora_downloads)
|
604 |
+
|
605 |
+
if 'prompt' in preset_prepared and preset_prepared.get('prompt') == '':
|
606 |
+
del preset_prepared['prompt']
|
607 |
+
|
608 |
+
return modules.meta_parser.load_parameter_button_click(json.dumps(preset_prepared), is_generating)
|
609 |
+
|
610 |
+
preset_selection.change(preset_selection_change, inputs=[preset_selection, state_is_generating], outputs=load_data_outputs, queue=False, show_progress=True) \
|
611 |
+
.then(fn=style_sorter.sort_styles, inputs=style_selections, outputs=style_selections, queue=False, show_progress=False) \
|
612 |
+
|
613 |
+
performance_selection.change(lambda x: [gr.update(interactive=not flags.Performance.has_restricted_features(x))] * 11 +
|
614 |
+
[gr.update(visible=not flags.Performance.has_restricted_features(x))] * 1 +
|
615 |
+
[gr.update(interactive=not flags.Performance.has_restricted_features(x), value=flags.Performance.has_restricted_features(x))] * 1,
|
616 |
+
inputs=performance_selection,
|
617 |
+
outputs=[
|
618 |
+
guidance_scale, sharpness, adm_scaler_end, adm_scaler_positive,
|
619 |
+
adm_scaler_negative, refiner_switch, refiner_model, sampler_name,
|
620 |
+
scheduler_name, adaptive_cfg, refiner_swap_method, negative_prompt, disable_intermediate_results
|
621 |
+
], queue=False, show_progress=False)
|
622 |
+
|
623 |
+
output_format.input(lambda x: gr.update(output_format=x), inputs=output_format)
|
624 |
+
|
625 |
+
advanced_checkbox.change(lambda x: gr.update(visible=x), advanced_checkbox, advanced_column,
|
626 |
+
queue=False, show_progress=False) \
|
627 |
+
.then(fn=lambda: None, _js='refresh_grid_delayed', queue=False, show_progress=False)
|
628 |
+
|
629 |
+
def inpaint_mode_change(mode):
|
630 |
+
assert mode in modules.flags.inpaint_options
|
631 |
+
|
632 |
+
# inpaint_additional_prompt, outpaint_selections, example_inpaint_prompts,
|
633 |
+
# inpaint_disable_initial_latent, inpaint_engine,
|
634 |
+
# inpaint_strength, inpaint_respective_field
|
635 |
+
|
636 |
+
if mode == modules.flags.inpaint_option_detail:
|
637 |
+
return [
|
638 |
+
gr.update(visible=True), gr.update(visible=False, value=[]),
|
639 |
+
gr.Dataset.update(visible=True, samples=modules.config.example_inpaint_prompts),
|
640 |
+
False, 'None', 0.5, 0.0
|
641 |
+
]
|
642 |
+
|
643 |
+
if mode == modules.flags.inpaint_option_modify:
|
644 |
+
return [
|
645 |
+
gr.update(visible=True), gr.update(visible=False, value=[]),
|
646 |
+
gr.Dataset.update(visible=False, samples=modules.config.example_inpaint_prompts),
|
647 |
+
True, modules.config.default_inpaint_engine_version, 1.0, 0.0
|
648 |
+
]
|
649 |
|
|
|
650 |
return [
|
651 |
+
gr.update(visible=False, value=''), gr.update(visible=True),
|
652 |
gr.Dataset.update(visible=False, samples=modules.config.example_inpaint_prompts),
|
653 |
+
False, modules.config.default_inpaint_engine_version, 1.0, 0.618
|
654 |
]
|
655 |
|
656 |
+
inpaint_mode.input(inpaint_mode_change, inputs=inpaint_mode, outputs=[
|
657 |
+
inpaint_additional_prompt, outpaint_selections, example_inpaint_prompts,
|
658 |
+
inpaint_disable_initial_latent, inpaint_engine,
|
659 |
+
inpaint_strength, inpaint_respective_field
|
660 |
+
], show_progress=False, queue=False)
|
661 |
+
|
662 |
+
ctrls = [currentTask, generate_image_grid]
|
663 |
+
ctrls += [
|
664 |
+
prompt, negative_prompt, style_selections,
|
665 |
+
performance_selection, aspect_ratios_selection, image_number, output_format, image_seed,
|
666 |
+
read_wildcards_in_order, sharpness, guidance_scale
|
667 |
]
|
668 |
|
669 |
+
ctrls += [base_model, refiner_model, refiner_switch] + lora_ctrls
|
670 |
+
ctrls += [input_image_checkbox, current_tab]
|
671 |
+
ctrls += [uov_method, uov_input_image]
|
672 |
+
ctrls += [outpaint_selections, inpaint_input_image, inpaint_additional_prompt, inpaint_mask_image]
|
673 |
+
ctrls += [disable_preview, disable_intermediate_results, disable_seed_increment]
|
674 |
+
ctrls += [adm_scaler_positive, adm_scaler_negative, adm_scaler_end, adaptive_cfg]
|
675 |
+
ctrls += [sampler_name, scheduler_name]
|
676 |
+
ctrls += [overwrite_step, overwrite_switch, overwrite_width, overwrite_height, overwrite_vary_strength]
|
677 |
+
ctrls += [overwrite_upscale_strength, mixing_image_prompt_and_vary_upscale, mixing_image_prompt_and_inpaint]
|
678 |
+
ctrls += [debugging_cn_preprocessor, skipping_cn_preprocessor, canny_low_threshold, canny_high_threshold]
|
679 |
+
ctrls += [refiner_swap_method, controlnet_softness]
|
680 |
+
ctrls += freeu_ctrls
|
681 |
+
ctrls += inpaint_ctrls
|
682 |
+
|
683 |
+
if not args_manager.args.disable_metadata:
|
684 |
+
ctrls += [save_metadata_to_images, metadata_scheme]
|
685 |
+
|
686 |
+
ctrls += ip_ctrls
|
687 |
+
|
688 |
+
def parse_meta(raw_prompt_txt, is_generating):
|
689 |
+
loaded_json = None
|
690 |
+
if is_json(raw_prompt_txt):
|
691 |
+
loaded_json = json.loads(raw_prompt_txt)
|
692 |
+
|
693 |
+
if loaded_json is None:
|
694 |
+
if is_generating:
|
695 |
+
return gr.update(), gr.update(), gr.update()
|
696 |
+
else:
|
697 |
+
return gr.update(), gr.update(visible=True), gr.update(visible=False)
|
698 |
+
|
699 |
+
return json.dumps(loaded_json), gr.update(visible=False), gr.update(visible=True)
|
700 |
+
|
701 |
+
prompt.input(parse_meta, inputs=[prompt, state_is_generating], outputs=[prompt, generate_button, load_parameter_button], queue=False, show_progress=False)
|
702 |
+
|
703 |
+
load_parameter_button.click(modules.meta_parser.load_parameter_button_click, inputs=[prompt, state_is_generating], outputs=load_data_outputs, queue=False, show_progress=False)
|
704 |
+
|
705 |
+
def trigger_metadata_import(filepath, state_is_generating):
|
706 |
+
parameters, metadata_scheme = modules.meta_parser.read_info_from_image(filepath)
|
707 |
+
if parameters is None:
|
708 |
+
print('Could not find metadata in the image!')
|
709 |
+
parsed_parameters = {}
|
710 |
else:
|
711 |
+
metadata_parser = modules.meta_parser.get_metadata_parser(metadata_scheme)
|
712 |
+
parsed_parameters = metadata_parser.parse_json(parameters)
|
713 |
+
|
714 |
+
return modules.meta_parser.load_parameter_button_click(parsed_parameters, state_is_generating)
|
715 |
+
|
716 |
+
metadata_import_button.click(trigger_metadata_import, inputs=[metadata_input_image, state_is_generating], outputs=load_data_outputs, queue=False, show_progress=True) \
|
717 |
+
.then(style_sorter.sort_styles, inputs=style_selections, outputs=style_selections, queue=False, show_progress=False)
|
718 |
+
|
719 |
+
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), [], True),
|
720 |
+
outputs=[stop_button, skip_button, generate_button, gallery, state_is_generating]) \
|
721 |
+
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
722 |
+
.then(fn=get_task, inputs=ctrls, outputs=currentTask) \
|
723 |
+
.then(fn=generate_clicked, inputs=currentTask, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
724 |
+
.then(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), gr.update(visible=False, interactive=False), False),
|
725 |
+
outputs=[generate_button, stop_button, skip_button, state_is_generating]) \
|
726 |
+
.then(fn=update_history_link, outputs=history_link) \
|
727 |
+
.then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed')
|
728 |
+
|
729 |
+
for notification_file in ['notification.ogg', 'notification.mp3']:
|
730 |
+
if os.path.exists(notification_file):
|
731 |
+
gr.Audio(interactive=False, value=notification_file, elem_id='audio_notification', visible=False)
|
732 |
+
break
|
733 |
+
|
734 |
+
def trigger_describe(mode, img):
|
735 |
+
if mode == flags.desc_type_photo:
|
736 |
+
from extras.interrogate import default_interrogator as default_interrogator_photo
|
737 |
+
return default_interrogator_photo(img), ["Fooocus V2", "Fooocus Enhance", "Fooocus Sharp"]
|
738 |
+
if mode == flags.desc_type_anime:
|
739 |
+
from extras.wd14tagger import default_interrogator as default_interrogator_anime
|
740 |
+
return default_interrogator_anime(img), ["Fooocus V2", "Fooocus Masterpiece"]
|
741 |
+
return mode, ["Fooocus V2"]
|
742 |
+
|
743 |
+
desc_btn.click(trigger_describe, inputs=[desc_method, desc_input_image],
|
744 |
+
outputs=[prompt, style_selections], show_progress=True, queue=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
|
746 |
|
747 |
def dump_default_english_config():
|