Spaces:
Runtime error
Runtime error
tomaseo2022
commited on
Commit
•
49569aa
1
Parent(s):
fea5af8
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import os
|
2 |
os.system("conda install pytorch torchvision -c pytorch")
|
3 |
os.system("pip install torch")
|
4 |
import gradio as gr
|
@@ -16,7 +16,12 @@ def inference(img):
|
|
16 |
img = img.resize((basewidth,hsize), Image.ANTIALIAS)
|
17 |
img.save("test/1.jpg", "JPEG")
|
18 |
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')
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
title = "SwinIR"
|
22 |
description = "Gradio demo for SwinIR. SwinIR achieves state-of-the-art performance on six tasks: image super-resolution (including classical, lightweight and real-world image super-resolution), image denoising (including grayscale and color image denoising) and JPEG compression artifact reduction. See the paper and project page for detailed results below. Here, we provide a demo for real-world image SR.To use it, simply upload your image, or click one of the examples to load them."
|
@@ -26,9 +31,9 @@ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2108.102
|
|
26 |
gr.Interface(
|
27 |
inference,
|
28 |
[gr.inputs.Image(type="pil", label="Input")],
|
29 |
-
gr.outputs.Image(type="
|
30 |
title=title,
|
31 |
description=description,
|
32 |
article=article,
|
33 |
enable_queue=True
|
34 |
-
).launch(debug=True)
|
|
|
1 |
+
import os
|
2 |
os.system("conda install pytorch torchvision -c pytorch")
|
3 |
os.system("pip install torch")
|
4 |
import gradio as gr
|
|
|
16 |
img = img.resize((basewidth,hsize), Image.ANTIALIAS)
|
17 |
img.save("test/1.jpg", "JPEG")
|
18 |
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')
|
19 |
+
|
20 |
+
# Load the output image file as an Image object
|
21 |
+
output_img = Image.open('results/swinir_real_sr_x4/1_SwinIR.png')
|
22 |
+
|
23 |
+
# Return the output image
|
24 |
+
return output_img
|
25 |
|
26 |
title = "SwinIR"
|
27 |
description = "Gradio demo for SwinIR. SwinIR achieves state-of-the-art performance on six tasks: image super-resolution (including classical, lightweight and real-world image super-resolution), image denoising (including grayscale and color image denoising) and JPEG compression artifact reduction. See the paper and project page for detailed results below. Here, we provide a demo for real-world image SR.To use it, simply upload your image, or click one of the examples to load them."
|
|
|
31 |
gr.Interface(
|
32 |
inference,
|
33 |
[gr.inputs.Image(type="pil", label="Input")],
|
34 |
+
gr.outputs.Image(type="pil", label="Output"),
|
35 |
title=title,
|
36 |
description=description,
|
37 |
article=article,
|
38 |
enable_queue=True
|
39 |
+
).launch(debug=True)
|