Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -146,12 +146,17 @@ def infer_60(
|
|
146 |
pyx.upload_to_ftp(sd35_path)
|
147 |
upscaler_2.to(torch.device('cuda'))
|
148 |
with torch.no_grad():
|
149 |
-
|
|
|
150 |
print('-- got upscaled image --')
|
151 |
-
|
|
|
152 |
upscale_path = f"sd35ll_upscale_{timestamp}.png"
|
153 |
-
|
|
|
|
|
154 |
pyx.upload_to_ftp(upscale_path)
|
|
|
155 |
return sd_image, prompt
|
156 |
|
157 |
@spaces.GPU(duration=100)
|
@@ -196,12 +201,17 @@ def infer_90(
|
|
196 |
pyx.upload_to_ftp(sd35_path)
|
197 |
upscaler_2.to(torch.device('cuda'))
|
198 |
with torch.no_grad():
|
199 |
-
|
|
|
200 |
print('-- got upscaled image --')
|
201 |
-
|
|
|
202 |
upscale_path = f"sd35ll_upscale_{timestamp}.png"
|
203 |
-
|
|
|
|
|
204 |
pyx.upload_to_ftp(upscale_path)
|
|
|
205 |
return sd_image, prompt
|
206 |
|
207 |
@spaces.GPU(duration=120)
|
@@ -246,12 +256,17 @@ def infer_110(
|
|
246 |
pyx.upload_to_ftp(sd35_path)
|
247 |
upscaler_2.to(torch.device('cuda'))
|
248 |
with torch.no_grad():
|
249 |
-
|
|
|
250 |
print('-- got upscaled image --')
|
251 |
-
|
|
|
252 |
upscale_path = f"sd35ll_upscale_{timestamp}.png"
|
253 |
-
|
|
|
|
|
254 |
pyx.upload_to_ftp(upscale_path)
|
|
|
255 |
return sd_image, prompt
|
256 |
|
257 |
css = """
|
|
|
146 |
pyx.upload_to_ftp(sd35_path)
|
147 |
upscaler_2.to(torch.device('cuda'))
|
148 |
with torch.no_grad():
|
149 |
+
upscale = upscaler_2(sd_image, tiling=True, tile_width=512, tile_height=512)
|
150 |
+
upscale2 = upscaler_2(upscale, tiling=True, tile_width=512, tile_height=512)
|
151 |
print('-- got upscaled image --')
|
152 |
+
downscale = upscale2.resize((upscale2.width // 4, upscale2.height // 4),Image.LANCZOS)
|
153 |
+
downscale2 = downscale.resize((downscale.width // 4, downscale.height // 4),Image.LANCZOS)
|
154 |
upscale_path = f"sd35ll_upscale_{timestamp}.png"
|
155 |
+
upscale2_path = f"sd35ll_upscale2_{timestamp}.png"
|
156 |
+
downscale.save(upscale_path,optimize=False,compress_level=0)
|
157 |
+
downscale2.save(upscale2_path,optimize=False,compress_level=0)
|
158 |
pyx.upload_to_ftp(upscale_path)
|
159 |
+
pyx.upload_to_ftp(upscale2_path)
|
160 |
return sd_image, prompt
|
161 |
|
162 |
@spaces.GPU(duration=100)
|
|
|
201 |
pyx.upload_to_ftp(sd35_path)
|
202 |
upscaler_2.to(torch.device('cuda'))
|
203 |
with torch.no_grad():
|
204 |
+
upscale = upscaler_2(sd_image, tiling=True, tile_width=512, tile_height=512)
|
205 |
+
upscale2 = upscaler_2(upscale, tiling=True, tile_width=512, tile_height=512)
|
206 |
print('-- got upscaled image --')
|
207 |
+
downscale = upscale2.resize((upscale2.width // 4, upscale2.height // 4),Image.LANCZOS)
|
208 |
+
downscale2 = downscale.resize((downscale.width // 4, downscale.height // 4),Image.LANCZOS)
|
209 |
upscale_path = f"sd35ll_upscale_{timestamp}.png"
|
210 |
+
upscale2_path = f"sd35ll_upscale2_{timestamp}.png"
|
211 |
+
downscale.save(upscale_path,optimize=False,compress_level=0)
|
212 |
+
downscale2.save(upscale2_path,optimize=False,compress_level=0)
|
213 |
pyx.upload_to_ftp(upscale_path)
|
214 |
+
pyx.upload_to_ftp(upscale2_path)
|
215 |
return sd_image, prompt
|
216 |
|
217 |
@spaces.GPU(duration=120)
|
|
|
256 |
pyx.upload_to_ftp(sd35_path)
|
257 |
upscaler_2.to(torch.device('cuda'))
|
258 |
with torch.no_grad():
|
259 |
+
upscale = upscaler_2(sd_image, tiling=True, tile_width=512, tile_height=512)
|
260 |
+
upscale2 = upscaler_2(upscale, tiling=True, tile_width=512, tile_height=512)
|
261 |
print('-- got upscaled image --')
|
262 |
+
downscale = upscale2.resize((upscale2.width // 4, upscale2.height // 4),Image.LANCZOS)
|
263 |
+
downscale2 = downscale.resize((downscale.width // 4, downscale.height // 4),Image.LANCZOS)
|
264 |
upscale_path = f"sd35ll_upscale_{timestamp}.png"
|
265 |
+
upscale2_path = f"sd35ll_upscale2_{timestamp}.png"
|
266 |
+
downscale.save(upscale_path,optimize=False,compress_level=0)
|
267 |
+
downscale2.save(upscale2_path,optimize=False,compress_level=0)
|
268 |
pyx.upload_to_ftp(upscale_path)
|
269 |
+
pyx.upload_to_ftp(upscale2_path)
|
270 |
return sd_image, prompt
|
271 |
|
272 |
css = """
|