Fabrice-TIERCELIN
commited on
Commit
•
8479e8d
1
Parent(s):
6d07e55
Comment to test
Browse files- gradio_demo.py +14 -13
gradio_demo.py
CHANGED
@@ -73,19 +73,20 @@ def stage1_process(input_image, gamma_correction):
|
|
73 |
gr.Warning('Set this space to GPU config to make it work.')
|
74 |
return None
|
75 |
torch.cuda.set_device(SUPIR_device)
|
76 |
-
LQ = HWC3(input_image)
|
77 |
-
LQ = fix_resize(LQ, 512)
|
78 |
-
|
79 |
-
LQ = np.array(LQ) / 255 * 2 - 1
|
80 |
-
LQ = torch.tensor(LQ, dtype=torch.float32).permute(2, 0, 1).unsqueeze(0).to(SUPIR_device)[:, :3, :, :]
|
81 |
-
LQ = model.batchify_denoise(LQ, is_stage1=True)
|
82 |
-
LQ = (LQ[0].permute(1, 2, 0) * 127.5 + 127.5).cpu().numpy().round().clip(0, 255).astype(np.uint8)
|
83 |
-
|
84 |
-
LQ = LQ / 255.0
|
85 |
-
LQ = np.power(LQ, gamma_correction)
|
86 |
-
LQ *= 255.0
|
87 |
-
LQ = LQ.round().clip(0, 255).astype(np.uint8)
|
88 |
-
return LQ
|
|
|
89 |
|
90 |
@spaces.GPU(duration=120)
|
91 |
def llave_process(input_image, temperature, top_p, qs=None):
|
|
|
73 |
gr.Warning('Set this space to GPU config to make it work.')
|
74 |
return None
|
75 |
torch.cuda.set_device(SUPIR_device)
|
76 |
+
#LQ = HWC3(input_image)
|
77 |
+
#LQ = fix_resize(LQ, 512)
|
78 |
+
## stage1
|
79 |
+
#LQ = np.array(LQ) / 255 * 2 - 1
|
80 |
+
#LQ = torch.tensor(LQ, dtype=torch.float32).permute(2, 0, 1).unsqueeze(0).to(SUPIR_device)[:, :3, :, :]
|
81 |
+
#LQ = model.batchify_denoise(LQ, is_stage1=True)
|
82 |
+
#LQ = (LQ[0].permute(1, 2, 0) * 127.5 + 127.5).cpu().numpy().round().clip(0, 255).astype(np.uint8)
|
83 |
+
## gamma correction
|
84 |
+
#LQ = LQ / 255.0
|
85 |
+
#LQ = np.power(LQ, gamma_correction)
|
86 |
+
#LQ *= 255.0
|
87 |
+
#LQ = LQ.round().clip(0, 255).astype(np.uint8)
|
88 |
+
#return LQ
|
89 |
+
return None
|
90 |
|
91 |
@spaces.GPU(duration=120)
|
92 |
def llave_process(input_image, temperature, top_p, qs=None):
|