jhj0517 commited on
Commit
f73fef2
1 Parent(s): 703e5b8

Migrate to official RealESRGAN version

Browse files
modules/image_restoration/real_esrgan_inferencer.py CHANGED
@@ -4,10 +4,9 @@ import torch
4
  from PIL import Image
5
  import numpy as np
6
  from typing import Optional
7
- from RealESRGAN import RealESRGAN
8
 
9
  from modules.utils.paths import *
10
- from .model_downloader import *
11
 
12
 
13
  class RealESRGANInferencer:
@@ -18,12 +17,15 @@ class RealESRGANInferencer:
18
  self.output_dir = output_dir
19
  self.device = self.get_device()
20
  self.model = None
 
 
 
21
  self.available_models = list(MODELS_REALESRGAN_URL.keys())
22
  self.default_model = self.available_models[0]
23
 
24
  def load_model(self,
25
  model_name: Optional[str] = None,
26
- scale: int = 2,
27
  progress: gr.Progress = gr.Progress()):
28
  if model_name is None:
29
  model_name = self.default_model
 
4
  from PIL import Image
5
  import numpy as np
6
  from typing import Optional
 
7
 
8
  from modules.utils.paths import *
9
+ from .model_downloader import download_resrgan_model, MODELS_REALESRGAN_URL
10
 
11
 
12
  class RealESRGANInferencer:
 
17
  self.output_dir = output_dir
18
  self.device = self.get_device()
19
  self.model = None
20
+ self.up_sampler = None
21
+ self.face_enhancer = None
22
+
23
  self.available_models = list(MODELS_REALESRGAN_URL.keys())
24
  self.default_model = self.available_models[0]
25
 
26
  def load_model(self,
27
  model_name: Optional[str] = None,
28
+ scale: int = 1,
29
  progress: gr.Progress = gr.Progress()):
30
  if model_name is None:
31
  model_name = self.default_model