Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,27 +13,39 @@ def greet(name):
|
|
13 |
return "Hello " + name + "!!"
|
14 |
|
15 |
def transformation(image):
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
#
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
|
28 |
#preds=np.array(preds)
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
ImageLoader.save_image(preds, './scaled_2x.png')
|
31 |
ImageLoader.save_compare(inputs, preds, './scaled_2x_compare.png')
|
|
|
|
|
|
|
|
|
32 |
|
33 |
|
34 |
|
35 |
# large_image = cartoon_upsampling_8x(image, 'a_8x_larger_output_image.png' )
|
36 |
-
|
37 |
|
38 |
with gr.Blocks() as demo:
|
39 |
image1=gr.Image(type='filepath')
|
|
|
13 |
return "Hello " + name + "!!"
|
14 |
|
15 |
def transformation(image):
|
16 |
+
# print(image)
|
17 |
+
# print( type(image) )
|
18 |
+
# url = 'https://paperswithcode.com/media/datasets/Set5-0000002728-07a9793f_zA3bDjj.jpg'
|
19 |
+
# imagee = Image.open(requests.get(url, stream=True).raw)
|
20 |
+
# model = EdsrModel.from_pretrained('eugenesiow/edsr-base', scale=4)
|
21 |
+
# inputs = ImageLoader.load_image(imagee)
|
22 |
+
# preds = model(inputs)
|
23 |
+
# print("1 :",preds)
|
24 |
+
# print( type(preds) )
|
25 |
+
# prednumpy=preds.detach().numpy()
|
26 |
|
27 |
|
28 |
#preds=np.array(preds)
|
29 |
+
# print("2 :",prednumpy)
|
30 |
+
# ImageLoader.save_image(preds, './scaled_2x.png')
|
31 |
+
# ImageLoader.save_compare(inputs, preds, './scaled_2x_compare.png')
|
32 |
+
|
33 |
+
url = 'https://paperswithcode.com/media/datasets/Set5-0000002728-07a9793f_zA3bDjj.jpg'
|
34 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
35 |
+
model = EdsrModel.from_pretrained('eugenesiow/edsr-base', scale=2)
|
36 |
+
inputs = ImageLoader.load_image(image)
|
37 |
+
preds = model(inputs)
|
38 |
ImageLoader.save_image(preds, './scaled_2x.png')
|
39 |
ImageLoader.save_compare(inputs, preds, './scaled_2x_compare.png')
|
40 |
+
prednumpy=preds.detach().numpy()
|
41 |
+
return prednumpy
|
42 |
+
|
43 |
+
|
44 |
|
45 |
|
46 |
|
47 |
# large_image = cartoon_upsampling_8x(image, 'a_8x_larger_output_image.png' )
|
48 |
+
# return prednumpy
|
49 |
|
50 |
with gr.Blocks() as demo:
|
51 |
image1=gr.Image(type='filepath')
|