Spaces:
Runtime error
Runtime error
Eugene Siow
commited on
Commit
·
f0575e8
1
Parent(s):
037d730
Add fix for output to PIL image.
Browse files
app.py
CHANGED
|
@@ -46,13 +46,15 @@ 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',
|
| 53 |
'baby.bmp')
|
| 54 |
torch.hub.download_url_to_file('http://people.rennes.inria.fr/Aline.Roumy/results/images_SR_BMVC12/input_groundtruth/woman_mini_d3_gaussian.bmp',
|
| 55 |
'woman.bmp')
|
|
|
|
|
|
|
| 56 |
models = ['EDSR-base', 'DRLN', 'EDSR', 'MSRN', 'MDSR', 'AWSRN-BAM', 'A2N', 'CARN', 'PAN']
|
| 57 |
scales = [2, 3, 4]
|
| 58 |
for model_name in models:
|
|
@@ -73,7 +75,8 @@ gr.Interface(
|
|
| 73 |
article=article,
|
| 74 |
examples=[
|
| 75 |
['baby.bmp', 'x2', 'EDSR-base'],
|
| 76 |
-
['woman.bmp', 'x3', 'DRLN']
|
|
|
|
| 77 |
],
|
| 78 |
enable_queue=True,
|
| 79 |
allow_flagging=False,
|
|
|
|
| 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 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',
|
| 53 |
'baby.bmp')
|
| 54 |
torch.hub.download_url_to_file('http://people.rennes.inria.fr/Aline.Roumy/results/images_SR_BMVC12/input_groundtruth/woman_mini_d3_gaussian.bmp',
|
| 55 |
'woman.bmp')
|
| 56 |
+
torch.hub.download_url_to_file('http://people.rennes.inria.fr/Aline.Roumy/results/images_SR_BMVC12/input_groundtruth/bird_mini_d4_gaussian.bmp',
|
| 57 |
+
'bird.bmp')
|
| 58 |
models = ['EDSR-base', 'DRLN', 'EDSR', 'MSRN', 'MDSR', 'AWSRN-BAM', 'A2N', 'CARN', 'PAN']
|
| 59 |
scales = [2, 3, 4]
|
| 60 |
for model_name in models:
|
|
|
|
| 75 |
article=article,
|
| 76 |
examples=[
|
| 77 |
['baby.bmp', 'x2', 'EDSR-base'],
|
| 78 |
+
['woman.bmp', 'x3', 'DRLN'],
|
| 79 |
+
['bird.bmp', 'x4', 'EDSR']
|
| 80 |
],
|
| 81 |
enable_queue=True,
|
| 82 |
allow_flagging=False,
|