Spaces:
Paused
Paused
Fabrice-TIERCELIN
commited on
Commit
•
da86870
1
Parent(s):
bb54994
Allocation time
Browse files- gradio_demo.py +109 -7
gradio_demo.py
CHANGED
@@ -144,9 +144,107 @@ def stage2_process(
|
|
144 |
spt_linear_CFG,
|
145 |
spt_linear_s_stage2,
|
146 |
model_select,
|
147 |
-
output_format
|
|
|
148 |
):
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
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
|
151 |
)
|
152 |
|
@@ -431,6 +529,7 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
431 |
with gr.Column():
|
432 |
ae_dtype = gr.Radio(['fp32', 'bf16'], label="Auto-Encoder Data Type", value="bf16",
|
433 |
interactive=True)
|
|
|
434 |
randomize_seed = gr.Checkbox(label = "\U0001F3B2 Randomize seed", value = True, info = "If checked, result is always different")
|
435 |
seed = gr.Slider(label="Seed", minimum=0, maximum=2147483647, step=1, randomize=True)
|
436 |
with gr.Group():
|
@@ -481,7 +580,8 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
481 |
spt_linear_CFG,
|
482 |
spt_linear_s_stage2,
|
483 |
model_select,
|
484 |
-
output_format
|
|
|
485 |
],
|
486 |
outputs = [
|
487 |
result_slider,
|
@@ -508,7 +608,7 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
508 |
42,
|
509 |
5,
|
510 |
1.003,
|
511 |
-
"
|
512 |
"fp16",
|
513 |
"bf16",
|
514 |
1.0,
|
@@ -517,7 +617,8 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
517 |
False,
|
518 |
0.,
|
519 |
"v0-Q",
|
520 |
-
"png"
|
|
|
521 |
],
|
522 |
[
|
523 |
"./Examples/Example2.jpeg",
|
@@ -546,10 +647,11 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
546 |
False,
|
547 |
0.,
|
548 |
"v0-Q",
|
549 |
-
"png"
|
|
|
550 |
],
|
551 |
],
|
552 |
-
cache_examples =
|
553 |
)
|
554 |
|
555 |
with gr.Row():
|
|
|
144 |
spt_linear_CFG,
|
145 |
spt_linear_s_stage2,
|
146 |
model_select,
|
147 |
+
output_format,
|
148 |
+
allocation
|
149 |
):
|
150 |
+
if allocation == 1:
|
151 |
+
return restore_in_1min(
|
152 |
+
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
|
153 |
+
)
|
154 |
+
if allocation == 2:
|
155 |
+
return restore_in_2min(
|
156 |
+
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
|
157 |
+
)
|
158 |
+
if allocation == 3:
|
159 |
+
return restore_in_3min(
|
160 |
+
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
|
161 |
+
)
|
162 |
+
if allocation == 4:
|
163 |
+
return restore_in_4min(
|
164 |
+
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
|
165 |
+
)
|
166 |
+
if allocation == 5:
|
167 |
+
return restore_in_5min(
|
168 |
+
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
|
169 |
+
)
|
170 |
+
if allocation == 7:
|
171 |
+
return restore_in_7min(
|
172 |
+
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
|
173 |
+
)
|
174 |
+
if allocation == 8:
|
175 |
+
return restore_in_8min(
|
176 |
+
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
|
177 |
+
)
|
178 |
+
if allocation == 9:
|
179 |
+
return restore_in_9min(
|
180 |
+
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
|
181 |
+
)
|
182 |
+
else:
|
183 |
+
return restore_in_6min(
|
184 |
+
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
|
185 |
+
)
|
186 |
+
|
187 |
+
@spaces.GPU(duration=60)
|
188 |
+
def restore_in_1min(
|
189 |
+
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
|
190 |
+
):
|
191 |
+
return restore(
|
192 |
+
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
|
193 |
+
)
|
194 |
+
|
195 |
+
@spaces.GPU(duration=120)
|
196 |
+
def restore_in_2min(
|
197 |
+
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
|
198 |
+
):
|
199 |
+
return restore(
|
200 |
+
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
|
201 |
+
)
|
202 |
+
|
203 |
+
@spaces.GPU(duration=180)
|
204 |
+
def restore_in_3min(
|
205 |
+
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
|
206 |
+
):
|
207 |
+
return restore(
|
208 |
+
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
|
209 |
+
)
|
210 |
+
|
211 |
+
@spaces.GPU(duration=240)
|
212 |
+
def restore_in_4min(
|
213 |
+
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
|
214 |
+
):
|
215 |
+
return restore(
|
216 |
+
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
|
217 |
+
)
|
218 |
+
|
219 |
+
@spaces.GPU(duration=300)
|
220 |
+
def restore_in_5min(
|
221 |
+
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
|
222 |
+
):
|
223 |
+
return restore(
|
224 |
+
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
|
225 |
+
)
|
226 |
+
|
227 |
+
@spaces.GPU(duration=360)
|
228 |
+
def restore_in_6min(
|
229 |
+
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
|
230 |
+
):
|
231 |
+
return restore(
|
232 |
+
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
|
233 |
+
)
|
234 |
+
|
235 |
+
@spaces.GPU(duration=420)
|
236 |
+
def restore_in_7min(
|
237 |
+
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
|
238 |
+
):
|
239 |
+
return restore(
|
240 |
+
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
|
241 |
+
)
|
242 |
+
|
243 |
+
@spaces.GPU(duration=480)
|
244 |
+
def restore_in_8min(
|
245 |
+
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
|
246 |
+
):
|
247 |
+
return restore(
|
248 |
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
|
249 |
)
|
250 |
|
|
|
529 |
with gr.Column():
|
530 |
ae_dtype = gr.Radio(['fp32', 'bf16'], label="Auto-Encoder Data Type", value="bf16",
|
531 |
interactive=True)
|
532 |
+
allocation = gr.Radio([["1 min", 1], ["2 min", 2], ["3 min", 3], ["4 min", 4], ["5 min", 5], ["6 min", 6], ["7 min", 7], ["8 min", 8], ["9 min", 9]], label="GPU allocation time", info="lower=May abort run, higher=Time penalty for next runs", value=6, interactive=True)
|
533 |
randomize_seed = gr.Checkbox(label = "\U0001F3B2 Randomize seed", value = True, info = "If checked, result is always different")
|
534 |
seed = gr.Slider(label="Seed", minimum=0, maximum=2147483647, step=1, randomize=True)
|
535 |
with gr.Group():
|
|
|
580 |
spt_linear_CFG,
|
581 |
spt_linear_s_stage2,
|
582 |
model_select,
|
583 |
+
output_format,
|
584 |
+
allocation
|
585 |
],
|
586 |
outputs = [
|
587 |
result_slider,
|
|
|
608 |
42,
|
609 |
5,
|
610 |
1.003,
|
611 |
+
"AdaIn",
|
612 |
"fp16",
|
613 |
"bf16",
|
614 |
1.0,
|
|
|
617 |
False,
|
618 |
0.,
|
619 |
"v0-Q",
|
620 |
+
"png",
|
621 |
+
6
|
622 |
],
|
623 |
[
|
624 |
"./Examples/Example2.jpeg",
|
|
|
647 |
False,
|
648 |
0.,
|
649 |
"v0-Q",
|
650 |
+
"png",
|
651 |
+
6
|
652 |
],
|
653 |
],
|
654 |
+
cache_examples = "lazy",
|
655 |
)
|
656 |
|
657 |
with gr.Row():
|