Ahsen Khaliq commited on
Commit
943b977
1 Parent(s): c29221d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -19
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import os
2
  os.system("pip install gfpgan")
3
- os.system("pip install realesrgan")
4
  os.system("pip freeze")
5
  os.system("wget https://github.com/TencentARC/GFPGAN/releases/download/v0.2.0/GFPGANCleanv1-NoCE-C2.pth -P .")
6
  import random
@@ -16,24 +15,11 @@ import numpy as np
16
  from basicsr.utils import imwrite
17
  from gfpgan import GFPGANer
18
 
19
- # background upsampler
20
- if not torch.cuda.is_available(): # CPU
21
- import warnings
22
- warnings.warn('The unoptimized RealESRGAN is very slow on CPU. We do not use it. '
23
- 'If you really want to use it, please modify the corresponding codes.')
24
- bg_upsampler = None
25
- else:
26
- from basicsr.archs.rrdbnet_arch import RRDBNet
27
- from realesrgan import RealESRGANer
28
- model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=2)
29
- bg_upsampler = RealESRGANer(
30
- scale=2,
31
- model_path='https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth',
32
- model=model,
33
- tile=200,
34
- tile_pad=10,
35
- pre_pad=0,
36
- half=True) # need to set False in CPU mode
37
 
38
 
39
  # set up GFPGAN restorer
 
1
  import os
2
  os.system("pip install gfpgan")
 
3
  os.system("pip freeze")
4
  os.system("wget https://github.com/TencentARC/GFPGAN/releases/download/v0.2.0/GFPGANCleanv1-NoCE-C2.pth -P .")
5
  import random
 
15
  from basicsr.utils import imwrite
16
  from gfpgan import GFPGANer
17
 
18
+ import warnings
19
+ warnings.warn('The unoptimized RealESRGAN is very slow on CPU. We do not use it. '
20
+ 'If you really want to use it, please modify the corresponding codes.')
21
+ bg_upsampler = None
22
+
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
 
25
  # set up GFPGAN restorer