shichen1231 commited on
Commit
a874c16
1 Parent(s): 09bc6fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -9,10 +9,10 @@ import math
9
 
10
 
11
  def greet(input_img, input_model_name, input_tile_mode):
12
- if input_img.size[0] * input_img.size[1] > 256 * 256:
13
- y = int(math.sqrt(256*256/input_img.size[0]*input_img.size[1]))
14
- x = int(input_img.size[0]/input_img.size[1]*y)
15
- input_img = ImageOps.fit(input_img, (x, y))
16
  input_img = np.array(input_img)
17
  if input_model_name not in model_cache:
18
  t1 = time.time()
@@ -42,7 +42,7 @@ if __name__ == '__main__':
42
  ModelPath = "weights_v3/"
43
  model_cache = {}
44
 
45
- input_model_name = gr.inputs.Dropdown(os.listdir(ModelPath), default="up2x-latest-no-denoise.pth", label='选择model')
46
  input_tile_mode = gr.inputs.Dropdown([0, 1, 2, 3, 4], default=2, label='选择tile_mode')
47
  input_img = gr.inputs.Image(label='image', type='pil')
48
 
@@ -53,7 +53,7 @@ if __name__ == '__main__':
53
  outputs=outputs,
54
  allow_screenshot=False,
55
  allow_flagging='never',
56
- examples=[['test-img.jpg', "up2x-latest-no-denoise.pth", 2]],
57
  article='[https://github.com/bilibili/ailab/tree/main/Real-CUGAN](https://github.com/bilibili/ailab/tree/main/Real-CUGAN)<br>'
58
  '感谢b站开源的项目,图片过大会导致内存不足,所有我将图片裁剪小,想体验大图片的效果请自行前往上面的链接。<br>'
59
  'The large image will lead to memory limit exceeded. So I crop and resize image. '
 
9
 
10
 
11
  def greet(input_img, input_model_name, input_tile_mode):
12
+ # if input_img.size[0] * input_img.size[1] > 256 * 256:
13
+ # y = int(math.sqrt(256*256/input_img.size[0]*input_img.size[1]))
14
+ # x = int(input_img.size[0]/input_img.size[1]*y)
15
+ # input_img = ImageOps.fit(input_img, (x, y))
16
  input_img = np.array(input_img)
17
  if input_model_name not in model_cache:
18
  t1 = time.time()
 
42
  ModelPath = "weights_v3/"
43
  model_cache = {}
44
 
45
+ input_model_name = gr.inputs.Dropdown(os.listdir(ModelPath), default="up3x-latest-no-denoise", label='选择model')
46
  input_tile_mode = gr.inputs.Dropdown([0, 1, 2, 3, 4], default=2, label='选择tile_mode')
47
  input_img = gr.inputs.Image(label='image', type='pil')
48
 
 
53
  outputs=outputs,
54
  allow_screenshot=False,
55
  allow_flagging='never',
56
+ examples=[['test-img.jpg', "up3x-latest-no-denoise", 2]],
57
  article='[https://github.com/bilibili/ailab/tree/main/Real-CUGAN](https://github.com/bilibili/ailab/tree/main/Real-CUGAN)<br>'
58
  '感谢b站开源的项目,图片过大会导致内存不足,所有我将图片裁剪小,想体验大图片的效果请自行前往上面的链接。<br>'
59
  'The large image will lead to memory limit exceeded. So I crop and resize image. '