Fix moving code
Browse files
app.py
CHANGED
|
@@ -210,8 +210,6 @@ def restore_in_Xmin(
|
|
| 210 |
|
| 211 |
denoise_image = HWC3(np.array(denoise_image))
|
| 212 |
|
| 213 |
-
torch.cuda.set_device(SUPIR_device)
|
| 214 |
-
|
| 215 |
if model_select != model.current_model:
|
| 216 |
print('load ' + model_select)
|
| 217 |
if model_select == 'v0-Q':
|
|
@@ -220,9 +218,6 @@ def restore_in_Xmin(
|
|
| 220 |
model.load_state_dict(ckpt_F, strict=False)
|
| 221 |
model.current_model = model_select
|
| 222 |
|
| 223 |
-
model.ae_dtype = convert_dtype(ae_dtype)
|
| 224 |
-
model.model.dtype = convert_dtype(diff_dtype)
|
| 225 |
-
|
| 226 |
# Allocation
|
| 227 |
if allocation == 1:
|
| 228 |
return restore_in_1min(
|
|
@@ -338,6 +333,11 @@ def restore(
|
|
| 338 |
start = time.time()
|
| 339 |
print('restore ==>>')
|
| 340 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
input_image = upscale_image(input_image, upscale, unit_resolution=32, min_size=min_size)
|
| 342 |
LQ = np.array(input_image) / 255.0
|
| 343 |
LQ = np.power(LQ, gamma_correction)
|
|
@@ -378,9 +378,6 @@ def restore(
|
|
| 378 |
" pixels large and " + str(result_height) + \
|
| 379 |
" pixels high, so a resolution of " + f'{result_width * result_height:,}' + " pixels."
|
| 380 |
print(information)
|
| 381 |
-
unique_name = str(uuid.uuid4()) + ".png"
|
| 382 |
-
results[0].save(unique_name)
|
| 383 |
-
print(unique_name)
|
| 384 |
|
| 385 |
# Only one image can be shown in the slider
|
| 386 |
return [noisy_image] + [results[0]], gr.update(label="Downloadable results in *." + output_format + " format", format = output_format, value = results), gr.update(value = information, visible = True)
|
|
|
|
| 210 |
|
| 211 |
denoise_image = HWC3(np.array(denoise_image))
|
| 212 |
|
|
|
|
|
|
|
| 213 |
if model_select != model.current_model:
|
| 214 |
print('load ' + model_select)
|
| 215 |
if model_select == 'v0-Q':
|
|
|
|
| 218 |
model.load_state_dict(ckpt_F, strict=False)
|
| 219 |
model.current_model = model_select
|
| 220 |
|
|
|
|
|
|
|
|
|
|
| 221 |
# Allocation
|
| 222 |
if allocation == 1:
|
| 223 |
return restore_in_1min(
|
|
|
|
| 333 |
start = time.time()
|
| 334 |
print('restore ==>>')
|
| 335 |
|
| 336 |
+
torch.cuda.set_device(SUPIR_device)
|
| 337 |
+
|
| 338 |
+
model.ae_dtype = convert_dtype(ae_dtype)
|
| 339 |
+
model.model.dtype = convert_dtype(diff_dtype)
|
| 340 |
+
|
| 341 |
input_image = upscale_image(input_image, upscale, unit_resolution=32, min_size=min_size)
|
| 342 |
LQ = np.array(input_image) / 255.0
|
| 343 |
LQ = np.power(LQ, gamma_correction)
|
|
|
|
| 378 |
" pixels large and " + str(result_height) + \
|
| 379 |
" pixels high, so a resolution of " + f'{result_width * result_height:,}' + " pixels."
|
| 380 |
print(information)
|
|
|
|
|
|
|
|
|
|
| 381 |
|
| 382 |
# Only one image can be shown in the slider
|
| 383 |
return [noisy_image] + [results[0]], gr.update(label="Downloadable results in *." + output_format + " format", format = output_format, value = results), gr.update(value = information, visible = True)
|