restore_in_9min
Browse files- gradio_demo.py +14 -32
gradio_demo.py
CHANGED
|
@@ -146,37 +146,18 @@ def stage2_process(
|
|
| 146 |
model_select,
|
| 147 |
output_format
|
| 148 |
):
|
| 149 |
-
return
|
| 150 |
-
noisy_image,
|
| 151 |
-
denoise_image,
|
| 152 |
-
prompt,
|
| 153 |
-
a_prompt,
|
| 154 |
-
n_prompt,
|
| 155 |
-
num_samples,
|
| 156 |
-
min_size,
|
| 157 |
-
downscale,
|
| 158 |
-
upscale,
|
| 159 |
-
edm_steps,
|
| 160 |
-
s_stage1,
|
| 161 |
-
s_stage2,
|
| 162 |
-
s_cfg,
|
| 163 |
-
randomize_seed,
|
| 164 |
-
seed,
|
| 165 |
-
s_churn,
|
| 166 |
-
s_noise,
|
| 167 |
-
color_fix_type,
|
| 168 |
-
diff_dtype,
|
| 169 |
-
ae_dtype,
|
| 170 |
-
gamma_correction,
|
| 171 |
-
linear_CFG,
|
| 172 |
-
linear_s_stage2,
|
| 173 |
-
spt_linear_CFG,
|
| 174 |
-
spt_linear_s_stage2,
|
| 175 |
-
model_select,
|
| 176 |
-
output_format
|
| 177 |
)
|
| 178 |
|
| 179 |
@spaces.GPU(duration=540)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
def restore(
|
| 181 |
noisy_image,
|
| 182 |
denoise_image,
|
|
@@ -285,13 +266,14 @@ def restore(
|
|
| 285 |
hours = math.floor(minutes / 60)
|
| 286 |
minutes = minutes - (hours * 60)
|
| 287 |
information = ("Start the process again if you want a different result. " if randomize_seed else "") + \
|
| 288 |
-
"
|
| 289 |
-
" pixels large and " + str(result_height) + \
|
| 290 |
-
" pixels high, so a resolution of " + f'{result_width * result_height:,}' + " pixels. " + \
|
| 291 |
"The image(s) has(ve) been generated in " + \
|
| 292 |
((str(hours) + " h, ") if hours != 0 else "") + \
|
| 293 |
((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") + \
|
| 294 |
-
str(secondes) + " sec."
|
|
|
|
|
|
|
|
|
|
| 295 |
print(information)
|
| 296 |
|
| 297 |
# Only one image can be shown in the slider
|
|
|
|
| 146 |
model_select,
|
| 147 |
output_format
|
| 148 |
):
|
| 149 |
+
return restore_in_9min(
|
| 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 |
|
| 153 |
@spaces.GPU(duration=540)
|
| 154 |
+
def restore_in_9min(
|
| 155 |
+
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
|
| 156 |
+
):
|
| 157 |
+
return restore(
|
| 158 |
+
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
|
| 159 |
+
)
|
| 160 |
+
|
| 161 |
def restore(
|
| 162 |
noisy_image,
|
| 163 |
denoise_image,
|
|
|
|
| 266 |
hours = math.floor(minutes / 60)
|
| 267 |
minutes = minutes - (hours * 60)
|
| 268 |
information = ("Start the process again if you want a different result. " if randomize_seed else "") + \
|
| 269 |
+
"Wait 9 min before a new run to avoid time penalty. " + \
|
|
|
|
|
|
|
| 270 |
"The image(s) has(ve) been generated in " + \
|
| 271 |
((str(hours) + " h, ") if hours != 0 else "") + \
|
| 272 |
((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") + \
|
| 273 |
+
str(secondes) + " sec. " + \
|
| 274 |
+
"The new image resolution is " + str(result_width) + \
|
| 275 |
+
" pixels large and " + str(result_height) + \
|
| 276 |
+
" pixels high, so a resolution of " + f'{result_width * result_height:,}' + " pixels."
|
| 277 |
print(information)
|
| 278 |
|
| 279 |
# Only one image can be shown in the slider
|