optipng
Browse files
app.py
CHANGED
@@ -3,13 +3,15 @@ import gradio as gr
|
|
3 |
from PIL import Image
|
4 |
import torch
|
5 |
|
6 |
-
|
|
|
7 |
os.system('wget https://github.com/JingyunLiang/SwinIR/releases/download/v0.0/003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth -P experiments/pretrained_models')
|
8 |
|
9 |
def inference(img):
|
10 |
os.system('mkdir test')
|
11 |
-
img.save("test/1.
|
12 |
os.system('python main_test_swinir.py --task real_sr --model_path experiments/pretrained_models/003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth --folder_lq test --scale 4')
|
|
|
13 |
return 'results/swinir_real_sr_x4/1_SwinIR.png'
|
14 |
|
15 |
title = "SwinIR"
|
|
|
3 |
from PIL import Image
|
4 |
import torch
|
5 |
|
6 |
+
|
7 |
+
os.system('apt-get update; apt-get install optipng')
|
8 |
os.system('wget https://github.com/JingyunLiang/SwinIR/releases/download/v0.0/003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth -P experiments/pretrained_models')
|
9 |
|
10 |
def inference(img):
|
11 |
os.system('mkdir test')
|
12 |
+
img.save("test/1.png", "PNG")
|
13 |
os.system('python main_test_swinir.py --task real_sr --model_path experiments/pretrained_models/003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth --folder_lq test --scale 4')
|
14 |
+
os.system("optipng -o5 results/swinir_real_sr_x4/1_SwinIR.png")
|
15 |
return 'results/swinir_real_sr_x4/1_SwinIR.png'
|
16 |
|
17 |
title = "SwinIR"
|