Spaces:
Running
Running
Fabrice-TIERCELIN
commited on
Advices
Browse files
app.py
CHANGED
@@ -28,11 +28,11 @@ def check(
|
|
28 |
prompt,
|
29 |
negative_prompt,
|
30 |
smooth_border,
|
31 |
-
denoising_steps,
|
32 |
num_inference_steps,
|
33 |
guidance_scale,
|
34 |
image_guidance_scale,
|
35 |
strength,
|
|
|
36 |
randomize_seed,
|
37 |
seed,
|
38 |
debug_mode,
|
@@ -72,11 +72,11 @@ def uncrop(
|
|
72 |
prompt,
|
73 |
negative_prompt,
|
74 |
smooth_border,
|
75 |
-
denoising_steps,
|
76 |
num_inference_steps,
|
77 |
guidance_scale,
|
78 |
image_guidance_scale,
|
79 |
strength,
|
|
|
80 |
randomize_seed,
|
81 |
seed,
|
82 |
debug_mode,
|
@@ -90,11 +90,11 @@ def uncrop(
|
|
90 |
prompt,
|
91 |
negative_prompt,
|
92 |
smooth_border,
|
93 |
-
denoising_steps,
|
94 |
num_inference_steps,
|
95 |
guidance_scale,
|
96 |
image_guidance_scale,
|
97 |
strength,
|
|
|
98 |
randomize_seed,
|
99 |
seed,
|
100 |
debug_mode
|
@@ -120,9 +120,6 @@ def uncrop(
|
|
120 |
if smooth_border is None:
|
121 |
smooth_border = 0
|
122 |
|
123 |
-
if denoising_steps is None:
|
124 |
-
denoising_steps = 1000
|
125 |
-
|
126 |
if num_inference_steps is None:
|
127 |
num_inference_steps = 50
|
128 |
|
@@ -135,6 +132,9 @@ def uncrop(
|
|
135 |
if strength is None:
|
136 |
strength = 0.99
|
137 |
|
|
|
|
|
|
|
138 |
if randomize_seed:
|
139 |
seed = random.randint(0, max_64_bit_int)
|
140 |
|
@@ -315,11 +315,11 @@ with gr.Blocks() as interface:
|
|
315 |
with gr.Accordion("Advanced options", open = False):
|
316 |
negative_prompt = gr.Textbox(label = 'Negative prompt', placeholder = 'Describe what you do NOT want to see in the entire image', value = 'Border, frame, painting, scribbling, smear, noise, blur, watermark')
|
317 |
smooth_border = gr.Slider(minimum = 0, maximum = 1024, value = 0, step = 2, label = "Smooth border", info = "lower=preserve original, higher=seamless")
|
318 |
-
denoising_steps = gr.Slider(minimum = 0, maximum = 1000, value = 1000, step = 1, label = "Denoising", info = "lower=irrelevant result, higher=relevant result")
|
319 |
num_inference_steps = gr.Slider(minimum = 10, maximum = 100, value = 50, step = 1, label = "Number of inference steps", info = "lower=faster, higher=image quality")
|
320 |
guidance_scale = gr.Slider(minimum = 1, maximum = 13, value = 7, step = 0.1, label = "Classifier-Free Guidance Scale", info = "lower=image quality, higher=follow the prompt")
|
321 |
image_guidance_scale = gr.Slider(minimum = 1, value = 1.5, step = 0.1, label = "Image Guidance Scale", info = "lower=image quality, higher=follow the image")
|
322 |
-
strength = gr.
|
|
|
323 |
randomize_seed = gr.Checkbox(label = "\U0001F3B2 Randomize seed (not working, always checked)", value = True, info = "If checked, result is always different")
|
324 |
seed = gr.Slider(minimum = 0, maximum = max_64_bit_int, step = 1, randomize = True, label = "Seed (if not randomized)")
|
325 |
debug_mode = gr.Checkbox(label = "Debug mode", value = False, info = "Show intermediate results")
|
@@ -351,11 +351,11 @@ with gr.Blocks() as interface:
|
|
351 |
prompt,
|
352 |
negative_prompt,
|
353 |
smooth_border,
|
354 |
-
denoising_steps,
|
355 |
num_inference_steps,
|
356 |
guidance_scale,
|
357 |
image_guidance_scale,
|
358 |
strength,
|
|
|
359 |
randomize_seed,
|
360 |
seed,
|
361 |
debug_mode
|
@@ -369,11 +369,11 @@ with gr.Blocks() as interface:
|
|
369 |
prompt,
|
370 |
negative_prompt,
|
371 |
smooth_border,
|
372 |
-
denoising_steps,
|
373 |
num_inference_steps,
|
374 |
guidance_scale,
|
375 |
image_guidance_scale,
|
376 |
strength,
|
|
|
377 |
randomize_seed,
|
378 |
seed,
|
379 |
debug_mode
|
@@ -395,11 +395,11 @@ with gr.Blocks() as interface:
|
|
395 |
prompt,
|
396 |
negative_prompt,
|
397 |
smooth_border,
|
398 |
-
denoising_steps,
|
399 |
num_inference_steps,
|
400 |
guidance_scale,
|
401 |
image_guidance_scale,
|
402 |
strength,
|
|
|
403 |
randomize_seed,
|
404 |
seed,
|
405 |
debug_mode
|
@@ -421,11 +421,11 @@ with gr.Blocks() as interface:
|
|
421 |
"A woman, black hair, nowadays, in the street, ultrarealistic, realistic, photorealistic, 8k",
|
422 |
"Border, frame, painting, drawing, cartoon, scribbling, smear, noise, blur, watermark",
|
423 |
0,
|
424 |
-
1000,
|
425 |
50,
|
426 |
7,
|
427 |
1.5,
|
428 |
0.99,
|
|
|
429 |
True,
|
430 |
42,
|
431 |
False
|
@@ -439,11 +439,11 @@ with gr.Blocks() as interface:
|
|
439 |
"A man, jumping in the air, outside, ultrarealistic, realistic, photorealistic, 8k",
|
440 |
"Border, frame, painting, drawing, cartoon, scribbling, smear, noise, blur, watermark",
|
441 |
0,
|
442 |
-
1000,
|
443 |
50,
|
444 |
7,
|
445 |
1.5,
|
446 |
0.99,
|
|
|
447 |
True,
|
448 |
42,
|
449 |
False
|
@@ -457,11 +457,11 @@ with gr.Blocks() as interface:
|
|
457 |
"An old yellow car, in a town, ultrarealistic, realistic, photorealistic, 8k",
|
458 |
"Border, frame, painting, drawing, cartoon, scribbling, smear, noise, blur, watermark",
|
459 |
0,
|
460 |
-
1000,
|
461 |
50,
|
462 |
7,
|
463 |
1.5,
|
464 |
0.99,
|
|
|
465 |
True,
|
466 |
42,
|
467 |
False
|
@@ -469,5 +469,41 @@ with gr.Blocks() as interface:
|
|
469 |
],
|
470 |
cache_examples = False,
|
471 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
|
473 |
interface.queue().launch()
|
|
|
28 |
prompt,
|
29 |
negative_prompt,
|
30 |
smooth_border,
|
|
|
31 |
num_inference_steps,
|
32 |
guidance_scale,
|
33 |
image_guidance_scale,
|
34 |
strength,
|
35 |
+
denoising_steps,
|
36 |
randomize_seed,
|
37 |
seed,
|
38 |
debug_mode,
|
|
|
72 |
prompt,
|
73 |
negative_prompt,
|
74 |
smooth_border,
|
|
|
75 |
num_inference_steps,
|
76 |
guidance_scale,
|
77 |
image_guidance_scale,
|
78 |
strength,
|
79 |
+
denoising_steps,
|
80 |
randomize_seed,
|
81 |
seed,
|
82 |
debug_mode,
|
|
|
90 |
prompt,
|
91 |
negative_prompt,
|
92 |
smooth_border,
|
|
|
93 |
num_inference_steps,
|
94 |
guidance_scale,
|
95 |
image_guidance_scale,
|
96 |
strength,
|
97 |
+
denoising_steps,
|
98 |
randomize_seed,
|
99 |
seed,
|
100 |
debug_mode
|
|
|
120 |
if smooth_border is None:
|
121 |
smooth_border = 0
|
122 |
|
|
|
|
|
|
|
123 |
if num_inference_steps is None:
|
124 |
num_inference_steps = 50
|
125 |
|
|
|
132 |
if strength is None:
|
133 |
strength = 0.99
|
134 |
|
135 |
+
if denoising_steps is None:
|
136 |
+
denoising_steps = 1000
|
137 |
+
|
138 |
if randomize_seed:
|
139 |
seed = random.randint(0, max_64_bit_int)
|
140 |
|
|
|
315 |
with gr.Accordion("Advanced options", open = False):
|
316 |
negative_prompt = gr.Textbox(label = 'Negative prompt', placeholder = 'Describe what you do NOT want to see in the entire image', value = 'Border, frame, painting, scribbling, smear, noise, blur, watermark')
|
317 |
smooth_border = gr.Slider(minimum = 0, maximum = 1024, value = 0, step = 2, label = "Smooth border", info = "lower=preserve original, higher=seamless")
|
|
|
318 |
num_inference_steps = gr.Slider(minimum = 10, maximum = 100, value = 50, step = 1, label = "Number of inference steps", info = "lower=faster, higher=image quality")
|
319 |
guidance_scale = gr.Slider(minimum = 1, maximum = 13, value = 7, step = 0.1, label = "Classifier-Free Guidance Scale", info = "lower=image quality, higher=follow the prompt")
|
320 |
image_guidance_scale = gr.Slider(minimum = 1, value = 1.5, step = 0.1, label = "Image Guidance Scale", info = "lower=image quality, higher=follow the image")
|
321 |
+
strength = gr.Slider(value = 0.99, minimum = 0.01, maximum = 1.0, step = 0.01, label = "Strength", info = "lower=follow the original area (discouraged), higher=redraw from scratch")
|
322 |
+
denoising_steps = gr.Number(minimum = 0, value = 1000, step = 1, label = "Denoising", info = "lower=irrelevant result, higher=relevant result")
|
323 |
randomize_seed = gr.Checkbox(label = "\U0001F3B2 Randomize seed (not working, always checked)", value = True, info = "If checked, result is always different")
|
324 |
seed = gr.Slider(minimum = 0, maximum = max_64_bit_int, step = 1, randomize = True, label = "Seed (if not randomized)")
|
325 |
debug_mode = gr.Checkbox(label = "Debug mode", value = False, info = "Show intermediate results")
|
|
|
351 |
prompt,
|
352 |
negative_prompt,
|
353 |
smooth_border,
|
|
|
354 |
num_inference_steps,
|
355 |
guidance_scale,
|
356 |
image_guidance_scale,
|
357 |
strength,
|
358 |
+
denoising_steps,
|
359 |
randomize_seed,
|
360 |
seed,
|
361 |
debug_mode
|
|
|
369 |
prompt,
|
370 |
negative_prompt,
|
371 |
smooth_border,
|
|
|
372 |
num_inference_steps,
|
373 |
guidance_scale,
|
374 |
image_guidance_scale,
|
375 |
strength,
|
376 |
+
denoising_steps,
|
377 |
randomize_seed,
|
378 |
seed,
|
379 |
debug_mode
|
|
|
395 |
prompt,
|
396 |
negative_prompt,
|
397 |
smooth_border,
|
|
|
398 |
num_inference_steps,
|
399 |
guidance_scale,
|
400 |
image_guidance_scale,
|
401 |
strength,
|
402 |
+
denoising_steps,
|
403 |
randomize_seed,
|
404 |
seed,
|
405 |
debug_mode
|
|
|
421 |
"A woman, black hair, nowadays, in the street, ultrarealistic, realistic, photorealistic, 8k",
|
422 |
"Border, frame, painting, drawing, cartoon, scribbling, smear, noise, blur, watermark",
|
423 |
0,
|
|
|
424 |
50,
|
425 |
7,
|
426 |
1.5,
|
427 |
0.99,
|
428 |
+
1000,
|
429 |
True,
|
430 |
42,
|
431 |
False
|
|
|
439 |
"A man, jumping in the air, outside, ultrarealistic, realistic, photorealistic, 8k",
|
440 |
"Border, frame, painting, drawing, cartoon, scribbling, smear, noise, blur, watermark",
|
441 |
0,
|
|
|
442 |
50,
|
443 |
7,
|
444 |
1.5,
|
445 |
0.99,
|
446 |
+
1000,
|
447 |
True,
|
448 |
42,
|
449 |
False
|
|
|
457 |
"An old yellow car, in a town, ultrarealistic, realistic, photorealistic, 8k",
|
458 |
"Border, frame, painting, drawing, cartoon, scribbling, smear, noise, blur, watermark",
|
459 |
0,
|
|
|
460 |
50,
|
461 |
7,
|
462 |
1.5,
|
463 |
0.99,
|
464 |
+
1000,
|
465 |
True,
|
466 |
42,
|
467 |
False
|
|
|
469 |
],
|
470 |
cache_examples = False,
|
471 |
)
|
472 |
+
|
473 |
+
gr.Markdown(
|
474 |
+
"""
|
475 |
+
## How to prompt your image
|
476 |
+
|
477 |
+
To easily read your prompt, start with the subject, then describ the pose or action, then secondary elements, then the background, then the graphical style, then the image quality:
|
478 |
+
```
|
479 |
+
A Vietnamese woman, red clothes, walking, smilling, in the street, a car on the left, in a modern city, photorealistic, 8k
|
480 |
+
```
|
481 |
+
|
482 |
+
You can use round brackets to increase the importance of a part:
|
483 |
+
```
|
484 |
+
A Vietnamese woman, (red clothes), walking, smilling, in the street, a car on the left, in a modern city, photorealistic, 8k
|
485 |
+
```
|
486 |
+
|
487 |
+
You can use several levels of round brackets to even more increase the importance of a part:
|
488 |
+
```
|
489 |
+
A Vietnamese woman, ((red clothes)), (walking), smilling, in the street, a car on the left, in a modern city, photorealistic, 8k
|
490 |
+
```
|
491 |
+
|
492 |
+
You can use number instead of several round brackets:
|
493 |
+
```
|
494 |
+
A Vietnamese woman, (red clothes:1.5), (walking), smilling, in the street, a car on the left, in a modern city, photorealistic, 8k
|
495 |
+
```
|
496 |
+
|
497 |
+
You can do the same thing with square brackets to decrease the importance of a part:
|
498 |
+
```
|
499 |
+
A [Vietnamese] woman, (red clothes:1.5), (walking), smilling, in the street, a car on the left, in a modern city, photorealistic, 8k
|
500 |
+
```
|
501 |
+
|
502 |
+
To easily read your negative prompt, organize it the same way as your prompt (not important for the AI):
|
503 |
+
```
|
504 |
+
man, boy, hat, running, tree, bicycle, forest, drawing, painting, cartoon, 3d, monochrome, blurry, noisy, bokeh
|
505 |
+
```
|
506 |
+
"""
|
507 |
+
)
|
508 |
|
509 |
interface.queue().launch()
|