Xintao commited on
Commit
7c69d8e
1 Parent(s): 201489f
Files changed (3) hide show
  1. app.py +1 -1
  2. gfpgan_utils.py +1 -1
  3. realesrgan_utils.py +1 -1
app.py CHANGED
@@ -35,7 +35,7 @@ netscale = 4
35
  model_path = os.path.join('weights', 'realesr-general-x4v3.pth')
36
 
37
  # restorer
38
- upsampler = RealESRGANer(scale=netscale, model_path=model_path, model=model, tile=0, tile_pad=10, pre_pad=0, half=True)
39
 
40
  # Use GFPGAN for face enhancement
41
  from gfpgan_utils import GFPGANer
 
35
  model_path = os.path.join('weights', 'realesr-general-x4v3.pth')
36
 
37
  # restorer
38
+ upsampler = RealESRGANer(scale=netscale, model_path=model_path, model=model, tile=0, tile_pad=10, pre_pad=0, half=False)
39
 
40
  # Use GFPGAN for face enhancement
41
  from gfpgan_utils import GFPGANer
gfpgan_utils.py CHANGED
@@ -33,7 +33,7 @@ class GFPGANer():
33
  self.bg_upsampler = bg_upsampler
34
 
35
  # initialize model
36
- self.device = torch.device('cuda') if device is None else device
37
  # initialize the GFP-GAN
38
  self.gfpgan = GFPGANv1Clean(
39
  out_size=512,
 
33
  self.bg_upsampler = bg_upsampler
34
 
35
  # initialize model
36
+ self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') if device is None else device
37
  # initialize the GFP-GAN
38
  self.gfpgan = GFPGANv1Clean(
39
  out_size=512,
realesrgan_utils.py CHANGED
@@ -36,7 +36,7 @@ class RealESRGANer():
36
  self.half = half
37
 
38
  # initialize model
39
- self.device = torch.device('cuda')
40
  # if the model_path starts with https, it will first download models to the folder: realesrgan/weights
41
  if model_path.startswith('https://'):
42
  model_path = load_file_from_url(
 
36
  self.half = half
37
 
38
  # initialize model
39
+ self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
40
  # if the model_path starts with https, it will first download models to the folder: realesrgan/weights
41
  if model_path.startswith('https://'):
42
  model_path = load_file_from_url(