juaben commited on
Commit
91844a8
·
verified ·
1 Parent(s): 4c73d46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -21,12 +21,12 @@ def load_img(filename):
21
  img_tensor = pil_to_tensor(img)
22
  return img_tensor
23
 
24
- def process_img(image, filename):
25
  # Select the correct weight file based on the image filename
26
 
27
  # filename = image.name.split("/")[-1]
28
  # if filename in image_to_weights:
29
- model_path = image_to_weights[1]
30
  checkpoints = torch.load(model_path, map_location=device)
31
  model.load_state_dict(checkpoints['params'])
32
  model.to(device)
@@ -59,7 +59,9 @@ Due to the GPU memory limitations, the app might crash if you feed a high-resolu
59
  examples = [
60
  ['images/low00772.png'],
61
  ['images/low00723.png'],
62
- ['images/low00748.png'],
 
 
63
  ]
64
 
65
  css = """
@@ -74,9 +76,7 @@ css = """
74
 
75
  demo = gr.Interface(
76
  fn = process_img,
77
- inputs = [
78
- gr.Image(type = 'pil', label = 'input')
79
- ],
80
  outputs = [gr.Image(type='pil', label = 'output')],
81
  title = title,
82
  description = description,
 
21
  img_tensor = pil_to_tensor(img)
22
  return img_tensor
23
 
24
+ def process_img(image, UHD_LL_model):
25
  # Select the correct weight file based on the image filename
26
 
27
  # filename = image.name.split("/")[-1]
28
  # if filename in image_to_weights:
29
+ model_path = image_to_weights[0] if UHD_LL_model else image_to_weights[1]
30
  checkpoints = torch.load(model_path, map_location=device)
31
  model.load_state_dict(checkpoints['params'])
32
  model.to(device)
 
59
  examples = [
60
  ['images/low00772.png'],
61
  ['images/low00723.png'],
62
+ ['images/425_UHD_LL.JPG'],
63
+ ['images/1778_UHD_LL.JPG'],
64
+ ['images/1791_UHD_LL.JPG']
65
  ]
66
 
67
  css = """
 
76
 
77
  demo = gr.Interface(
78
  fn = process_img,
79
+ inputs = [gr.Image(type = 'pil', label = 'input'), 'checkbox'],
 
 
80
  outputs = [gr.Image(type='pil', label = 'output')],
81
  title = title,
82
  description = description,