Spaces:
Runtime error
Runtime error
This PR sets allocation per second
Browse filesClick on _Merge_ to add this feature
app.py
CHANGED
@@ -73,7 +73,7 @@ def reset():
|
|
73 |
None,
|
74 |
None,
|
75 |
"Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
|
76 |
-
"painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, unsharp, weird textures, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
|
77 |
1,
|
78 |
1024,
|
79 |
1,
|
@@ -96,12 +96,13 @@ def reset():
|
|
96 |
0.,
|
97 |
"v0-Q",
|
98 |
"input",
|
99 |
-
|
100 |
]
|
101 |
|
102 |
-
def
|
103 |
if input_image is None:
|
104 |
raise gr.Error("Please provide an image to restore.")
|
|
|
105 |
|
106 |
@spaces.GPU(duration=420)
|
107 |
def stage1_process(
|
@@ -272,88 +273,43 @@ def restore_in_Xmin(
|
|
272 |
model.ae_dtype = convert_dtype(ae_dtype)
|
273 |
model.model.dtype = convert_dtype(diff_dtype)
|
274 |
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
noisy_image, denoise_image, prompt, a_prompt, n_prompt, num_samples, min_size, downscale, upscale, edm_steps, s_stage1, s_stage2, s_cfg, randomize_seed, seed, s_churn, s_noise, color_fix_type, diff_dtype, ae_dtype, gamma_correction, linear_CFG, linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2, model_select, output_format, allocation
|
279 |
-
)
|
280 |
-
if allocation == 2:
|
281 |
-
return restore_in_2min(
|
282 |
-
noisy_image, denoise_image, prompt, a_prompt, n_prompt, num_samples, min_size, downscale, upscale, edm_steps, s_stage1, s_stage2, s_cfg, randomize_seed, seed, s_churn, s_noise, color_fix_type, diff_dtype, ae_dtype, gamma_correction, linear_CFG, linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2, model_select, output_format, allocation
|
283 |
-
)
|
284 |
-
if allocation == 3:
|
285 |
-
return restore_in_3min(
|
286 |
-
noisy_image, denoise_image, prompt, a_prompt, n_prompt, num_samples, min_size, downscale, upscale, edm_steps, s_stage1, s_stage2, s_cfg, randomize_seed, seed, s_churn, s_noise, color_fix_type, diff_dtype, ae_dtype, gamma_correction, linear_CFG, linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2, model_select, output_format, allocation
|
287 |
-
)
|
288 |
-
if allocation == 4:
|
289 |
-
return restore_in_4min(
|
290 |
-
noisy_image, denoise_image, prompt, a_prompt, n_prompt, num_samples, min_size, downscale, upscale, edm_steps, s_stage1, s_stage2, s_cfg, randomize_seed, seed, s_churn, s_noise, color_fix_type, diff_dtype, ae_dtype, gamma_correction, linear_CFG, linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2, model_select, output_format, allocation
|
291 |
-
)
|
292 |
-
if allocation == 5:
|
293 |
-
return restore_in_5min(
|
294 |
-
noisy_image, denoise_image, prompt, a_prompt, n_prompt, num_samples, min_size, downscale, upscale, edm_steps, s_stage1, s_stage2, s_cfg, randomize_seed, seed, s_churn, s_noise, color_fix_type, diff_dtype, ae_dtype, gamma_correction, linear_CFG, linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2, model_select, output_format, allocation
|
295 |
-
)
|
296 |
-
if allocation == 7:
|
297 |
-
return restore_in_7min(
|
298 |
-
noisy_image, denoise_image, prompt, a_prompt, n_prompt, num_samples, min_size, downscale, upscale, edm_steps, s_stage1, s_stage2, s_cfg, randomize_seed, seed, s_churn, s_noise, color_fix_type, diff_dtype, ae_dtype, gamma_correction, linear_CFG, linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2, model_select, output_format, allocation
|
299 |
-
)
|
300 |
-
if allocation == 8:
|
301 |
-
return restore_in_8min(
|
302 |
-
noisy_image, denoise_image, prompt, a_prompt, n_prompt, num_samples, min_size, downscale, upscale, edm_steps, s_stage1, s_stage2, s_cfg, randomize_seed, seed, s_churn, s_noise, color_fix_type, diff_dtype, ae_dtype, gamma_correction, linear_CFG, linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2, model_select, output_format, allocation
|
303 |
-
)
|
304 |
-
if allocation == 9:
|
305 |
-
return restore_in_9min(
|
306 |
-
noisy_image, denoise_image, prompt, a_prompt, n_prompt, num_samples, min_size, downscale, upscale, edm_steps, s_stage1, s_stage2, s_cfg, randomize_seed, seed, s_churn, s_noise, color_fix_type, diff_dtype, ae_dtype, gamma_correction, linear_CFG, linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2, model_select, output_format, allocation
|
307 |
-
)
|
308 |
-
if allocation == 10:
|
309 |
-
return restore_in_10min(
|
310 |
-
noisy_image, denoise_image, prompt, a_prompt, n_prompt, num_samples, min_size, downscale, upscale, edm_steps, s_stage1, s_stage2, s_cfg, randomize_seed, seed, s_churn, s_noise, color_fix_type, diff_dtype, ae_dtype, gamma_correction, linear_CFG, linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2, model_select, output_format, allocation
|
311 |
-
)
|
312 |
-
else:
|
313 |
-
return restore_in_6min(
|
314 |
-
noisy_image, denoise_image, prompt, a_prompt, n_prompt, num_samples, min_size, downscale, upscale, edm_steps, s_stage1, s_stage2, s_cfg, randomize_seed, seed, s_churn, s_noise, color_fix_type, diff_dtype, ae_dtype, gamma_correction, linear_CFG, linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2, model_select, output_format, allocation
|
315 |
-
)
|
316 |
-
|
317 |
-
@spaces.GPU(duration=59)
|
318 |
-
def restore_in_1min(*args, **kwargs):
|
319 |
-
return restore_on_gpu(*args, **kwargs)
|
320 |
-
|
321 |
-
@spaces.GPU(duration=119)
|
322 |
-
def restore_in_2min(*args, **kwargs):
|
323 |
-
return restore_on_gpu(*args, **kwargs)
|
324 |
-
|
325 |
-
@spaces.GPU(duration=179)
|
326 |
-
def restore_in_3min(*args, **kwargs):
|
327 |
-
return restore_on_gpu(*args, **kwargs)
|
328 |
-
|
329 |
-
@spaces.GPU(duration=239)
|
330 |
-
def restore_in_4min(*args, **kwargs):
|
331 |
-
return restore_on_gpu(*args, **kwargs)
|
332 |
-
|
333 |
-
@spaces.GPU(duration=299)
|
334 |
-
def restore_in_5min(*args, **kwargs):
|
335 |
-
return restore_on_gpu(*args, **kwargs)
|
336 |
-
|
337 |
-
@spaces.GPU(duration=359)
|
338 |
-
def restore_in_6min(*args, **kwargs):
|
339 |
-
return restore_on_gpu(*args, **kwargs)
|
340 |
-
|
341 |
-
@spaces.GPU(duration=419)
|
342 |
-
def restore_in_7min(*args, **kwargs):
|
343 |
-
return restore_on_gpu(*args, **kwargs)
|
344 |
-
|
345 |
-
@spaces.GPU(duration=479)
|
346 |
-
def restore_in_8min(*args, **kwargs):
|
347 |
-
return restore_on_gpu(*args, **kwargs)
|
348 |
-
|
349 |
-
@spaces.GPU(duration=539)
|
350 |
-
def restore_in_9min(*args, **kwargs):
|
351 |
-
return restore_on_gpu(*args, **kwargs)
|
352 |
|
353 |
-
|
354 |
-
|
355 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
|
|
|
357 |
def restore_on_gpu(
|
358 |
noisy_image,
|
359 |
input_image,
|
@@ -541,10 +497,10 @@ with gr.Blocks() as interface:
|
|
541 |
rotation = gr.Radio([["No rotation", 0], ["⤵ Rotate +90°", 90], ["↩ Return 180°", 180], ["⤴ Rotate -90°", -90]], label="Orientation correction", info="Will apply the following rotation before restoring the image; the AI needs a good orientation to understand the content", value=0, interactive=True, visible=False)
|
542 |
with gr.Group():
|
543 |
prompt = gr.Textbox(label="Image description", info="Help the AI understand what the image represents; describe as much as possible, especially the details we can't see on the original image; you can write in any language", value="", placeholder="A 33 years old man, walking, in the street, Santiago, morning, Summer, photorealistic", lines=3)
|
544 |
-
prompt_hint = gr.HTML("You can use a <a href='"'https://huggingface.co/spaces/
|
545 |
upscale = gr.Radio([["x1", 1], ["x2", 2], ["x3", 3], ["x4", 4], ["x5", 5], ["x6", 6], ["x7", 7], ["x8", 8], ["x9", 9], ["x10", 10]], label="Upscale factor", info="Resolution x1 to x10", value=2, interactive=True)
|
546 |
output_format = gr.Radio([["As input", "input"], ["*.png", "png"], ["*.webp", "webp"], ["*.jpeg", "jpeg"], ["*.gif", "gif"], ["*.bmp", "bmp"]], label="Image format for result", info="File extention", value="input", interactive=True)
|
547 |
-
allocation = gr.
|
548 |
|
549 |
with gr.Accordion("Pre-denoising (optional)", open=False):
|
550 |
gamma_correction = gr.Slider(label="Gamma Correction", info = "lower=lighter, higher=darker", minimum=0.1, maximum=2.0, value=1.0, step=0.1)
|
@@ -557,17 +513,17 @@ with gr.Blocks() as interface:
|
|
557 |
info="Completes the main image description",
|
558 |
value='Cinematic, High Contrast, highly detailed, taken using a Canon EOS R '
|
559 |
'camera, hyper detailed photo - realistic maximum detail, 32k, Color '
|
560 |
-
'Grading, ultra HD, extreme meticulous detailing, skin pore detailing, '
|
561 |
'hyper sharpness, perfect without deformations.',
|
562 |
lines=3)
|
563 |
n_prompt = gr.Textbox(label="Negative image description",
|
564 |
info="Disambiguate by listing what the image does NOT represent",
|
565 |
value='painting, oil painting, illustration, drawing, art, sketch, anime, '
|
566 |
-
'cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, unsharp, weird textures, ugly, dirty, messy, '
|
567 |
'worst quality, low quality, frames, watermark, signature, jpeg artifacts, '
|
568 |
'deformed, lowres, over-smooth',
|
569 |
lines=3)
|
570 |
-
edm_steps = gr.Slider(label="Steps", info="lower=faster, higher=more details", minimum=1, maximum=200, value=default_setting.edm_steps if torch.cuda.device_count() > 0 else 1, step=1)
|
571 |
num_samples = gr.Slider(label="Num Samples", info="Number of generated results", minimum=1, maximum=4 if not args.use_image_slider else 1
|
572 |
, value=1, step=1)
|
573 |
min_size = gr.Slider(label="Minimum size", info="Minimum height, minimum width of the result", minimum=32, maximum=4096, value=1024, step=32)
|
@@ -610,6 +566,7 @@ with gr.Blocks() as interface:
|
|
610 |
diffusion_button = gr.Button(value="🚀 Upscale/Restore", variant = "primary", elem_id = "process_button")
|
611 |
reset_btn = gr.Button(value="🧹 Reinit page", variant="stop", elem_id="reset_button", visible = False)
|
612 |
|
|
|
613 |
restore_information = gr.HTML(value = "Restart the process to get another result.", visible = False)
|
614 |
result_slider = ImageSlider(label = 'Comparator', show_label = False, interactive = False, elem_id = "slider1", show_download_button = False)
|
615 |
result_gallery = gr.Gallery(label = 'Downloadable results', show_label = True, interactive = False, elem_id = "gallery1")
|
@@ -622,12 +579,12 @@ with gr.Blocks() as interface:
|
|
622 |
None,
|
623 |
"Group of people, walking, happy, in the street, photorealistic, 8k, extremely detailled",
|
624 |
"Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
|
625 |
-
"painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, unsharp, weird textures, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
|
626 |
2,
|
627 |
1024,
|
628 |
1,
|
629 |
8,
|
630 |
-
|
631 |
-1,
|
632 |
1,
|
633 |
7.5,
|
@@ -645,7 +602,7 @@ with gr.Blocks() as interface:
|
|
645 |
0.,
|
646 |
"v0-Q",
|
647 |
"input",
|
648 |
-
|
649 |
],
|
650 |
[
|
651 |
"./Examples/Example2.jpeg",
|
@@ -653,7 +610,7 @@ with gr.Blocks() as interface:
|
|
653 |
None,
|
654 |
"La cabeza de un gato atigrado, en una casa, fotorrealista, 8k, extremadamente detallada",
|
655 |
"Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
|
656 |
-
"painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, unsharp, weird textures, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
|
657 |
1,
|
658 |
1024,
|
659 |
1,
|
@@ -676,7 +633,7 @@ with gr.Blocks() as interface:
|
|
676 |
0.,
|
677 |
"v0-Q",
|
678 |
"input",
|
679 |
-
|
680 |
],
|
681 |
[
|
682 |
"./Examples/Example3.webp",
|
@@ -684,7 +641,7 @@ with gr.Blocks() as interface:
|
|
684 |
None,
|
685 |
"A red apple",
|
686 |
"Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
|
687 |
-
"painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, unsharp, weird textures, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
|
688 |
1,
|
689 |
1024,
|
690 |
1,
|
@@ -707,7 +664,7 @@ with gr.Blocks() as interface:
|
|
707 |
0.,
|
708 |
"v0-Q",
|
709 |
"input",
|
710 |
-
|
711 |
],
|
712 |
[
|
713 |
"./Examples/Example3.webp",
|
@@ -715,7 +672,7 @@ with gr.Blocks() as interface:
|
|
715 |
None,
|
716 |
"A red marble",
|
717 |
"Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
|
718 |
-
"painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, unsharp, weird textures, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
|
719 |
1,
|
720 |
1024,
|
721 |
1,
|
@@ -738,7 +695,7 @@ with gr.Blocks() as interface:
|
|
738 |
0.,
|
739 |
"v0-Q",
|
740 |
"input",
|
741 |
-
|
742 |
],
|
743 |
],
|
744 |
run_on_click = True,
|
@@ -792,9 +749,9 @@ with gr.Blocks() as interface:
|
|
792 |
rotation
|
793 |
], queue = False, show_progress = False)
|
794 |
|
795 |
-
denoise_button.click(fn =
|
796 |
input_image
|
797 |
-
], outputs = [], queue = False, show_progress = False).success(fn = stage1_process, inputs = [
|
798 |
input_image,
|
799 |
gamma_correction,
|
800 |
diff_dtype,
|
@@ -809,9 +766,9 @@ with gr.Blocks() as interface:
|
|
809 |
seed
|
810 |
], outputs = [
|
811 |
seed
|
812 |
-
], queue = False, show_progress = False).then(fn =
|
813 |
input_image
|
814 |
-
], outputs = [], queue = False, show_progress = False).success(fn=stage2_process, inputs = [
|
815 |
input_image,
|
816 |
rotation,
|
817 |
denoise_image,
|
|
|
73 |
None,
|
74 |
None,
|
75 |
"Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
|
76 |
+
"painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, pixel, unsharp, weird textures, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
|
77 |
1,
|
78 |
1024,
|
79 |
1,
|
|
|
96 |
0.,
|
97 |
"v0-Q",
|
98 |
"input",
|
99 |
+
179
|
100 |
]
|
101 |
|
102 |
+
def check_and_update(input_image):
|
103 |
if input_image is None:
|
104 |
raise gr.Error("Please provide an image to restore.")
|
105 |
+
return gr.update(visible = True)
|
106 |
|
107 |
@spaces.GPU(duration=420)
|
108 |
def stage1_process(
|
|
|
273 |
model.ae_dtype = convert_dtype(ae_dtype)
|
274 |
model.model.dtype = convert_dtype(diff_dtype)
|
275 |
|
276 |
+
return restore_on_gpu(
|
277 |
+
noisy_image, denoise_image, prompt, a_prompt, n_prompt, num_samples, min_size, downscale, upscale, edm_steps, s_stage1, s_stage2, s_cfg, randomize_seed, seed, s_churn, s_noise, color_fix_type, diff_dtype, ae_dtype, gamma_correction, linear_CFG, linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2, model_select, output_format, allocation
|
278 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
|
280 |
+
def get_duration(
|
281 |
+
noisy_image,
|
282 |
+
input_image,
|
283 |
+
prompt,
|
284 |
+
a_prompt,
|
285 |
+
n_prompt,
|
286 |
+
num_samples,
|
287 |
+
min_size,
|
288 |
+
downscale,
|
289 |
+
upscale,
|
290 |
+
edm_steps,
|
291 |
+
s_stage1,
|
292 |
+
s_stage2,
|
293 |
+
s_cfg,
|
294 |
+
randomize_seed,
|
295 |
+
seed,
|
296 |
+
s_churn,
|
297 |
+
s_noise,
|
298 |
+
color_fix_type,
|
299 |
+
diff_dtype,
|
300 |
+
ae_dtype,
|
301 |
+
gamma_correction,
|
302 |
+
linear_CFG,
|
303 |
+
linear_s_stage2,
|
304 |
+
spt_linear_CFG,
|
305 |
+
spt_linear_s_stage2,
|
306 |
+
model_select,
|
307 |
+
output_format,
|
308 |
+
allocation
|
309 |
+
):
|
310 |
+
return allocation
|
311 |
|
312 |
+
@spaces.GPU(duration=get_duration)
|
313 |
def restore_on_gpu(
|
314 |
noisy_image,
|
315 |
input_image,
|
|
|
497 |
rotation = gr.Radio([["No rotation", 0], ["⤵ Rotate +90°", 90], ["↩ Return 180°", 180], ["⤴ Rotate -90°", -90]], label="Orientation correction", info="Will apply the following rotation before restoring the image; the AI needs a good orientation to understand the content", value=0, interactive=True, visible=False)
|
498 |
with gr.Group():
|
499 |
prompt = gr.Textbox(label="Image description", info="Help the AI understand what the image represents; describe as much as possible, especially the details we can't see on the original image; you can write in any language", value="", placeholder="A 33 years old man, walking, in the street, Santiago, morning, Summer, photorealistic", lines=3)
|
500 |
+
prompt_hint = gr.HTML("You can use a <a href='"'https://huggingface.co/spaces/badayvedat/LLaVA'"'>LlaVa space</a> to auto-generate the description of your image.")
|
501 |
upscale = gr.Radio([["x1", 1], ["x2", 2], ["x3", 3], ["x4", 4], ["x5", 5], ["x6", 6], ["x7", 7], ["x8", 8], ["x9", 9], ["x10", 10]], label="Upscale factor", info="Resolution x1 to x10", value=2, interactive=True)
|
502 |
output_format = gr.Radio([["As input", "input"], ["*.png", "png"], ["*.webp", "webp"], ["*.jpeg", "jpeg"], ["*.gif", "gif"], ["*.bmp", "bmp"]], label="Image format for result", info="File extention", value="input", interactive=True)
|
503 |
+
allocation = gr.Slider(label="GPU allocation time (in seconds)", info="lower=May abort run, higher=Quota penalty for next runs", value=179, minimum=59, maximum=320, step=1)
|
504 |
|
505 |
with gr.Accordion("Pre-denoising (optional)", open=False):
|
506 |
gamma_correction = gr.Slider(label="Gamma Correction", info = "lower=lighter, higher=darker", minimum=0.1, maximum=2.0, value=1.0, step=0.1)
|
|
|
513 |
info="Completes the main image description",
|
514 |
value='Cinematic, High Contrast, highly detailed, taken using a Canon EOS R '
|
515 |
'camera, hyper detailed photo - realistic maximum detail, 32k, Color '
|
516 |
+
'Grading, ultra HD, extreme meticulous detailing, skin pore detailing, clothing fabric detailing, '
|
517 |
'hyper sharpness, perfect without deformations.',
|
518 |
lines=3)
|
519 |
n_prompt = gr.Textbox(label="Negative image description",
|
520 |
info="Disambiguate by listing what the image does NOT represent",
|
521 |
value='painting, oil painting, illustration, drawing, art, sketch, anime, '
|
522 |
+
'cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, pixel, unsharp, weird textures, ugly, dirty, messy, '
|
523 |
'worst quality, low quality, frames, watermark, signature, jpeg artifacts, '
|
524 |
'deformed, lowres, over-smooth',
|
525 |
lines=3)
|
526 |
+
edm_steps = gr.Slider(label="Steps", info="lower=faster, higher=more details; too many steps create a checker effect", minimum=1, maximum=200, value=default_setting.edm_steps if torch.cuda.device_count() > 0 else 1, step=1)
|
527 |
num_samples = gr.Slider(label="Num Samples", info="Number of generated results", minimum=1, maximum=4 if not args.use_image_slider else 1
|
528 |
, value=1, step=1)
|
529 |
min_size = gr.Slider(label="Minimum size", info="Minimum height, minimum width of the result", minimum=32, maximum=4096, value=1024, step=32)
|
|
|
566 |
diffusion_button = gr.Button(value="🚀 Upscale/Restore", variant = "primary", elem_id = "process_button")
|
567 |
reset_btn = gr.Button(value="🧹 Reinit page", variant="stop", elem_id="reset_button", visible = False)
|
568 |
|
569 |
+
warning = gr.HTML(value = "<center><big>Your computer must <u>not</u> enter into standby mode.</big><br/>On Chrome, you can force to keep a tab alive in <code>chrome://discards/</code></center>", visible = False)
|
570 |
restore_information = gr.HTML(value = "Restart the process to get another result.", visible = False)
|
571 |
result_slider = ImageSlider(label = 'Comparator', show_label = False, interactive = False, elem_id = "slider1", show_download_button = False)
|
572 |
result_gallery = gr.Gallery(label = 'Downloadable results', show_label = True, interactive = False, elem_id = "gallery1")
|
|
|
579 |
None,
|
580 |
"Group of people, walking, happy, in the street, photorealistic, 8k, extremely detailled",
|
581 |
"Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
|
582 |
+
"painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, pixel, unsharp, weird textures, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
|
583 |
2,
|
584 |
1024,
|
585 |
1,
|
586 |
8,
|
587 |
+
100,
|
588 |
-1,
|
589 |
1,
|
590 |
7.5,
|
|
|
602 |
0.,
|
603 |
"v0-Q",
|
604 |
"input",
|
605 |
+
179
|
606 |
],
|
607 |
[
|
608 |
"./Examples/Example2.jpeg",
|
|
|
610 |
None,
|
611 |
"La cabeza de un gato atigrado, en una casa, fotorrealista, 8k, extremadamente detallada",
|
612 |
"Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
|
613 |
+
"painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, pixel, unsharp, weird textures, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
|
614 |
1,
|
615 |
1024,
|
616 |
1,
|
|
|
633 |
0.,
|
634 |
"v0-Q",
|
635 |
"input",
|
636 |
+
179
|
637 |
],
|
638 |
[
|
639 |
"./Examples/Example3.webp",
|
|
|
641 |
None,
|
642 |
"A red apple",
|
643 |
"Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
|
644 |
+
"painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, pixel, unsharp, weird textures, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
|
645 |
1,
|
646 |
1024,
|
647 |
1,
|
|
|
664 |
0.,
|
665 |
"v0-Q",
|
666 |
"input",
|
667 |
+
179
|
668 |
],
|
669 |
[
|
670 |
"./Examples/Example3.webp",
|
|
|
672 |
None,
|
673 |
"A red marble",
|
674 |
"Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
|
675 |
+
"painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, aliasing, pixel, unsharp, weird textures, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
|
676 |
1,
|
677 |
1024,
|
678 |
1,
|
|
|
695 |
0.,
|
696 |
"v0-Q",
|
697 |
"input",
|
698 |
+
179
|
699 |
],
|
700 |
],
|
701 |
run_on_click = True,
|
|
|
749 |
rotation
|
750 |
], queue = False, show_progress = False)
|
751 |
|
752 |
+
denoise_button.click(fn = check_and_update, inputs = [
|
753 |
input_image
|
754 |
+
], outputs = [warning], queue = False, show_progress = False).success(fn = stage1_process, inputs = [
|
755 |
input_image,
|
756 |
gamma_correction,
|
757 |
diff_dtype,
|
|
|
766 |
seed
|
767 |
], outputs = [
|
768 |
seed
|
769 |
+
], queue = False, show_progress = False).then(fn = check_and_update, inputs = [
|
770 |
input_image
|
771 |
+
], outputs = [warning], queue = False, show_progress = False).success(fn=stage2_process, inputs = [
|
772 |
input_image,
|
773 |
rotation,
|
774 |
denoise_image,
|