Kev09 commited on
Commit
9320c3b
1 Parent(s): 2f3dd60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -1,5 +1,12 @@
1
  import gradio as gr
2
- from super_resolution import cartoon_upsampling_8x
 
 
 
 
 
 
 
3
 
4
  def greet(name):
5
  return "Hello " + name + "!!"
@@ -7,8 +14,19 @@ def greet(name):
7
  def transformation(image):
8
  print(image)
9
  print( type(image) )
10
- large_image = cartoon_upsampling_8x(image, 'a_8x_larger_output_image.png' )
11
- return large_image
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  with gr.Blocks() as demo:
14
  image1=gr.Image(type='filepath')
 
1
  import gradio as gr
2
+ import super-image
3
+
4
+
5
+ from super_image import EdsrModel, ImageLoader
6
+ from PIL import Image
7
+ import requests
8
+
9
+
10
 
11
  def greet(name):
12
  return "Hello " + name + "!!"
 
14
  def transformation(image):
15
  print(image)
16
  print( type(image) )
17
+ url = 'https://paperswithcode.com/media/datasets/Set5-0000002728-07a9793f_zA3bDjj.jpg'
18
+ image = Image.open(requests.get(url, stream=True).raw)
19
+ model = EdsrModel.from_pretrained('eugenesiow/edsr-base', scale=4)
20
+ inputs = ImageLoader.load_image(image)
21
+ preds = model(inputs)
22
+ print(preds)
23
+ ImageLoader.save_image(preds, './scaled_2x.png')
24
+ ImageLoader.save_compare(inputs, preds, './scaled_2x_compare.png')
25
+
26
+
27
+
28
+ # large_image = cartoon_upsampling_8x(image, 'a_8x_larger_output_image.png' )
29
+ return preds
30
 
31
  with gr.Blocks() as demo:
32
  image1=gr.Image(type='filepath')