Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,8 @@ import torch
|
|
6 |
from super_image import EdsrModel, ImageLoader
|
7 |
from PIL import Image
|
8 |
import requests
|
9 |
-
|
|
|
10 |
|
11 |
|
12 |
def greet(name):
|
@@ -40,11 +41,12 @@ def transformation(image):
|
|
40 |
# ImageLoader.save_image(preds, './scaled_2x.png')
|
41 |
ImageLoader.save_compare(inputs, preds, 'scaleed_2x_compare.png')
|
42 |
print("ok2")
|
43 |
-
prednumpy=preds.detach().numpy()
|
|
|
44 |
print('pnump',type(prednumpy))
|
45 |
print('predtype',type(preds))
|
46 |
print('ok3')
|
47 |
-
|
48 |
|
49 |
return prednumpy
|
50 |
|
@@ -59,7 +61,7 @@ with gr.Blocks() as demo:
|
|
59 |
image1=gr.Image(type='filepath')
|
60 |
|
61 |
button=gr.Button("LE BOUTON")
|
62 |
-
image2=gr.Image(type='
|
63 |
button.click(fn=transformation,inputs=image1,outputs=image2,api_name="upscale")
|
64 |
|
65 |
|
|
|
6 |
from super_image import EdsrModel, ImageLoader
|
7 |
from PIL import Image
|
8 |
import requests
|
9 |
+
import torchvision
|
10 |
+
import torchvision.transforms as T
|
11 |
|
12 |
|
13 |
def greet(name):
|
|
|
41 |
# ImageLoader.save_image(preds, './scaled_2x.png')
|
42 |
ImageLoader.save_compare(inputs, preds, 'scaleed_2x_compare.png')
|
43 |
print("ok2")
|
44 |
+
#prednumpy=preds.detach().numpy()
|
45 |
+
prednumpy=T.ToPILImage(preds)
|
46 |
print('pnump',type(prednumpy))
|
47 |
print('predtype',type(preds))
|
48 |
print('ok3')
|
49 |
+
# prednumpy = np.squeeze(prednumpy)
|
50 |
|
51 |
return prednumpy
|
52 |
|
|
|
61 |
image1=gr.Image(type='filepath')
|
62 |
|
63 |
button=gr.Button("LE BOUTON")
|
64 |
+
image2=gr.Image(type='pil')
|
65 |
button.click(fn=transformation,inputs=image1,outputs=image2,api_name="upscale")
|
66 |
|
67 |
|