gokaygokay commited on
Commit
7467e65
1 Parent(s): e2aa2f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import os
2
  import requests
3
  import time
@@ -18,8 +20,6 @@ from RealESRGAN import RealESRGAN
18
  import gradio as gr
19
  from gradio_imageslider import ImageSlider
20
 
21
- import spaces
22
-
23
  USE_TORCH_COMPILE = os.getenv("USE_TORCH_COMPILE", "0") == "1"
24
  ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD", "0") == "1"
25
 
@@ -132,7 +132,9 @@ class LazyRealESRGAN:
132
  return self.model.predict(img)
133
 
134
  lazy_realesrgan_x2 = LazyRealESRGAN(device, scale=2)
 
135
  lazy_realesrgan_x4 = LazyRealESRGAN(device, scale=4)
 
136
 
137
  @timer_func
138
  def resize_and_upscale(input_image, resolution):
@@ -165,6 +167,7 @@ def create_hdr_effect(original_image, hdr):
165
 
166
  lazy_pipe = LazyLoadPipeline()
167
  lazy_pipe.load()
 
168
 
169
  def prepare_image(input_image, resolution, hdr):
170
  condition_image = resize_and_upscale(input_image, resolution)
 
1
+ import spaces
2
+
3
  import os
4
  import requests
5
  import time
 
20
  import gradio as gr
21
  from gradio_imageslider import ImageSlider
22
 
 
 
23
  USE_TORCH_COMPILE = os.getenv("USE_TORCH_COMPILE", "0") == "1"
24
  ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD", "0") == "1"
25
 
 
132
  return self.model.predict(img)
133
 
134
  lazy_realesrgan_x2 = LazyRealESRGAN(device, scale=2)
135
+ lazy_realesrgan_x2 = torch.compile(lazy_realesrgan_x2)
136
  lazy_realesrgan_x4 = LazyRealESRGAN(device, scale=4)
137
+ lazy_realesrgan_x4 = torch.compile(lazy_realesrgan_x4)
138
 
139
  @timer_func
140
  def resize_and_upscale(input_image, resolution):
 
167
 
168
  lazy_pipe = LazyLoadPipeline()
169
  lazy_pipe.load()
170
+ lazy_pipe = lazy_pipe.to('cuda')
171
 
172
  def prepare_image(input_image, resolution, hdr):
173
  condition_image = resize_and_upscale(input_image, resolution)