banyapon commited on
Commit
354eaeb
·
1 Parent(s): f9597af

checkpoint GFPGANS

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -26,7 +26,14 @@ try:
26
  except Exception as e:
27
  raise RuntimeError(f"Error loading inpainting model: {e}")
28
 
29
- gfpgan = GFPGANer(model_path='https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth', upscale=1, device=torch.device('cpu'))
 
 
 
 
 
 
 
30
 
31
 
32
  def load_and_preprocess_image(image_path):
 
26
  except Exception as e:
27
  raise RuntimeError(f"Error loading inpainting model: {e}")
28
 
29
+ try:
30
+ from gfpgan import GFPGANer
31
+ except ModuleNotFoundError:
32
+ import subprocess
33
+ subprocess.run(["pip", "install", "gfpgan"])
34
+
35
+ # Initialize GFPGAN
36
+ gfpgan = GFPGANer(model_path='https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth',upscale=1, device=torch.device('cpu'))
37
 
38
 
39
  def load_and_preprocess_image(image_path):