hail75 commited on
Commit
5e1d820
·
1 Parent(s): 6e95c2f
Files changed (2) hide show
  1. app.py +1 -1
  2. models/SRFlow/srflow.py +3 -3
app.py CHANGED
@@ -134,7 +134,7 @@ if 'image' in locals():
134
  if st.button('Enhance with SRFlow'):
135
  with st.spinner('Processing using SRFlow...'):
136
  with st.spinner('Wait for it... the model is processing the image'):
137
- enhanced_image = return_SRFlow_result(image, divide=True)
138
  st.session_state['srflow_enhanced_image'] = enhanced_image
139
  st.session_state['srflow_clicked'] = True
140
  st.success('Done!')
 
134
  if st.button('Enhance with SRFlow'):
135
  with st.spinner('Processing using SRFlow...'):
136
  with st.spinner('Wait for it... the model is processing the image'):
137
+ enhanced_image = return_SRFlow_result(image)
138
  st.session_state['srflow_enhanced_image'] = enhanced_image
139
  st.session_state['srflow_clicked'] = True
140
  st.success('Done!')
models/SRFlow/srflow.py CHANGED
@@ -7,7 +7,7 @@ from PIL import Image
7
  import matplotlib.pyplot as plt
8
  from torchvision.transforms import PILToTensor, ToPILImage
9
 
10
- def return_SRFlow_result(lr, divide, conf_path='models/SRFlow/code/confs/SRFlow_DF2K_4X.yml'):
11
  """
12
  Apply Super-Resolution using SRFlow model to the input LR (low-resolution) image.
13
 
@@ -44,7 +44,7 @@ def return_SRFlow_result(lr, divide, conf_path='models/SRFlow/code/confs/SRFlow_
44
  sr_img = Image.fromarray((sr).astype('uint8'))
45
  return sr_img
46
 
47
- def return_SRFlow_result_from_tensor(lr_tensor, divide=True):
48
  """
49
  Apply Super-Resolution using SRFlow model to the input batched BCHW tensor.
50
 
@@ -68,7 +68,7 @@ def return_SRFlow_result_from_tensor(lr_tensor, divide=True):
68
 
69
  if not divide:
70
  sr_tensor = sr_tensor / 255
71
-
72
  return sr_tensor
73
 
74
  if __name__ == '__main__':
 
7
  import matplotlib.pyplot as plt
8
  from torchvision.transforms import PILToTensor, ToPILImage
9
 
10
+ def return_SRFlow_result(lr, divide=True, conf_path='models/SRFlow/code/confs/SRFlow_DF2K_4X.yml'):
11
  """
12
  Apply Super-Resolution using SRFlow model to the input LR (low-resolution) image.
13
 
 
44
  sr_img = Image.fromarray((sr).astype('uint8'))
45
  return sr_img
46
 
47
+ def return_SRFlow_result_from_tensor(lr_tensor, divide):
48
  """
49
  Apply Super-Resolution using SRFlow model to the input batched BCHW tensor.
50
 
 
68
 
69
  if not divide:
70
  sr_tensor = sr_tensor / 255
71
+
72
  return sr_tensor
73
 
74
  if __name__ == '__main__':