Spaces:
Runtime error
Runtime error
Eugene Siow
commited on
Commit
·
037d730
1
Parent(s):
3997eb3
Add fix for output to PIL image.
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import cv2
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
-
from
|
5 |
from super_image import ImageLoader, EdsrModel, MsrnModel, MdsrModel, AwsrnModel, A2nModel, CarnModel, PanModel, \
|
6 |
HanModel, DrlnModel, RcanModel
|
7 |
|
@@ -46,7 +46,7 @@ def inference(img, scale_str, model_name):
|
|
46 |
preds = preds.data.cpu().numpy()
|
47 |
pred = preds[0].transpose((1, 2, 0)) * 255.0
|
48 |
pred = cv2.cvtColor(pred, cv2.COLOR_BGR2RGB)
|
49 |
-
return
|
50 |
|
51 |
|
52 |
torch.hub.download_url_to_file('http://people.rennes.inria.fr/Aline.Roumy/results/images_SR_BMVC12/input_groundtruth/baby_mini_d3_gaussian.bmp',
|
|
|
1 |
import cv2
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
+
from PIL import Image
|
5 |
from super_image import ImageLoader, EdsrModel, MsrnModel, MdsrModel, AwsrnModel, A2nModel, CarnModel, PanModel, \
|
6 |
HanModel, DrlnModel, RcanModel
|
7 |
|
|
|
46 |
preds = preds.data.cpu().numpy()
|
47 |
pred = preds[0].transpose((1, 2, 0)) * 255.0
|
48 |
pred = cv2.cvtColor(pred, cv2.COLOR_BGR2RGB)
|
49 |
+
return Image.fromarray(pred)
|
50 |
|
51 |
|
52 |
torch.hub.download_url_to_file('http://people.rennes.inria.fr/Aline.Roumy/results/images_SR_BMVC12/input_groundtruth/baby_mini_d3_gaussian.bmp',
|