Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,12 +6,17 @@
|
|
6 |
# copies of the Software, and to permit persons to whom the Software is
|
7 |
import spaces
|
8 |
import os
|
|
|
|
|
9 |
os.putenv('TORCH_LINALG_PREFER_CUSOLVER','1')
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
os.environ["SAFETENSORS_FAST_GPU"] = "1"
|
12 |
os.putenv('HF_HUB_ENABLE_HF_TRANSFER','1')
|
13 |
|
14 |
-
|
15 |
import random
|
16 |
import uuid
|
17 |
import gradio as gr
|
@@ -285,7 +290,8 @@ def generate_30(
|
|
285 |
#gc.collect()
|
286 |
torch.set_float32_matmul_precision("medium")
|
287 |
with torch.no_grad():
|
288 |
-
|
|
|
289 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
290 |
downscale_path = f"rv50E_upscale_{timestamp}.png"
|
291 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
@@ -340,7 +346,8 @@ def generate_60(
|
|
340 |
image_paths = save_image(rv_image)
|
341 |
torch.set_float32_matmul_precision("medium")
|
342 |
with torch.no_grad():
|
343 |
-
|
|
|
344 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
345 |
downscale_path = f"rv50E_upscale_{timestamp}.png"
|
346 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
@@ -395,7 +402,8 @@ def generate_90(
|
|
395 |
image_paths = save_image(rv_image)
|
396 |
torch.set_float32_matmul_precision("medium")
|
397 |
with torch.no_grad():
|
398 |
-
|
|
|
399 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
400 |
downscale_path = f"rv50E_upscale_{timestamp}.png"
|
401 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
|
|
6 |
# copies of the Software, and to permit persons to whom the Software is
|
7 |
import spaces
|
8 |
import os
|
9 |
+
|
10 |
+
os.putenv('PYTORCH_NVML_BASED_CUDA_CHECK','1')
|
11 |
os.putenv('TORCH_LINALG_PREFER_CUSOLVER','1')
|
12 |
+
alloc_conf_parts = [
|
13 |
+
'expandable_segments:True',
|
14 |
+
'pinned_use_background_threads:True' # Specific to pinned memory.
|
15 |
+
]
|
16 |
+
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = ','.join(alloc_conf_parts)
|
17 |
os.environ["SAFETENSORS_FAST_GPU"] = "1"
|
18 |
os.putenv('HF_HUB_ENABLE_HF_TRANSFER','1')
|
19 |
|
|
|
20 |
import random
|
21 |
import uuid
|
22 |
import gradio as gr
|
|
|
290 |
#gc.collect()
|
291 |
torch.set_float32_matmul_precision("medium")
|
292 |
with torch.no_grad():
|
293 |
+
upscalea = upscaler(rv_image, tiling=True, tile_width=256, tile_height=256)
|
294 |
+
upscale = upscaler(upscalea, tiling=True, tile_width=256, tile_height=256)
|
295 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
296 |
downscale_path = f"rv50E_upscale_{timestamp}.png"
|
297 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
|
|
346 |
image_paths = save_image(rv_image)
|
347 |
torch.set_float32_matmul_precision("medium")
|
348 |
with torch.no_grad():
|
349 |
+
upscalea = upscaler(rv_image, tiling=True, tile_width=256, tile_height=256)
|
350 |
+
upscale = upscaler(upscalea, tiling=True, tile_width=256, tile_height=256)
|
351 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
352 |
downscale_path = f"rv50E_upscale_{timestamp}.png"
|
353 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
|
|
402 |
image_paths = save_image(rv_image)
|
403 |
torch.set_float32_matmul_precision("medium")
|
404 |
with torch.no_grad():
|
405 |
+
upscalea = upscaler(rv_image, tiling=True, tile_width=256, tile_height=256)
|
406 |
+
upscale = upscaler(upscalea, tiling=True, tile_width=256, tile_height=256)
|
407 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
408 |
downscale_path = f"rv50E_upscale_{timestamp}.png"
|
409 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|