NickKolok commited on
Commit
50a4094
·
verified ·
1 Parent(s): d581670
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -31,6 +31,7 @@ def run_cmd(command):
31
 
32
  run_cmd("wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P .")
33
  run_cmd("wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth -P .")
 
34
 
35
 
36
 
@@ -51,7 +52,10 @@ def inference(img,mode):
51
  run_cmd("python inference_realesrgan.py -n RealESRGAN_x4plus -i "+ INPUT_DIR + " -o " + OUTPUT_DIR)
52
  else:
53
  run_cmd("python inference_realesrgan.py -n RealESRGAN_x4plus_anime_6B -i "+ INPUT_DIR + " -o " + OUTPUT_DIR)
54
- return os.path.join(OUTPUT_DIR, "1_out.png")
 
 
 
55
 
56
 
57
 
 
31
 
32
  run_cmd("wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P .")
33
  run_cmd("wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth -P .")
34
+ run_cmd("apt-get update; apt-get install optipng")
35
 
36
 
37
 
 
52
  run_cmd("python inference_realesrgan.py -n RealESRGAN_x4plus -i "+ INPUT_DIR + " -o " + OUTPUT_DIR)
53
  else:
54
  run_cmd("python inference_realesrgan.py -n RealESRGAN_x4plus_anime_6B -i "+ INPUT_DIR + " -o " + OUTPUT_DIR)
55
+
56
+ image_filename = os.path.join(OUTPUT_DIR, "1_out.png")
57
+ run_cmd("optipng -o5 " + image_filename)
58
+ return image_filename
59
 
60
 
61