IanNathaniel commited on
Commit
e0bf326
1 Parent(s): 99cd6e8
app.py CHANGED
@@ -31,7 +31,7 @@ def lowlight(image_path):
31
  data_lowlight = data_lowlight.cpu().unsqueeze(0)
32
 
33
  DCE_net = model.enhance_net_nopool().cpu()
34
- DCE_net.load_state_dict(torch.load('Epoch99.pth'))
35
  start = time.time()
36
  _,enhanced_image,_ = DCE_net(data_lowlight)
37
 
@@ -47,8 +47,13 @@ def lowlight(image_path):
47
  if __name__ == '__main__':
48
  # test_images
49
  with torch.no_grad():
 
 
 
50
 
51
- for image
 
 
52
  # image = image
53
  print(image)
54
  lowlight(image)
@@ -58,7 +63,7 @@ title = "Compound Multi-branch Feature Fusion for Image Restoration (Deblur)"
58
  description = "Gradio demo for CMFNet. CMFNet achieves competitive performance on three tasks: image deblurring, image dehazing and image deraindrop. Here, we provide a demo for image deblur. To use it, simply upload your image, or click one of the examples to load them. Reference from: https://huggingface.co/akhaliq"
59
  article = "<p style='text-align: center'><a href='https://' target='_blank'>Compound Multi-branch Feature Fusion for Real Image Restoration</a> | <a href='https://github.com/FanChiMao/CMFNet' target='_blank'>Github Repo</a></p> <center><img src='https://visitor-badge.glitch.me/badge?page_id=52Hz_CMFNet_deblurring' alt='visitor badge'></center>"
60
 
61
- examples = [['01.jpg'], ['02.jpg'],]
62
  gr.Interface(
63
  inference,
64
  [gr.inputs.Image(type="pil", label="Input")],
 
31
  data_lowlight = data_lowlight.cpu().unsqueeze(0)
32
 
33
  DCE_net = model.enhance_net_nopool().cpu()
34
+ DCE_net.load_state_dict(torch.load('snapshots/Epoch99.pth'))
35
  start = time.time()
36
  _,enhanced_image,_ = DCE_net(data_lowlight)
37
 
 
47
  if __name__ == '__main__':
48
  # test_images
49
  with torch.no_grad():
50
+ filePath = 'data/test_data/'
51
+
52
+ file_list = os.listdir(filePath)
53
 
54
+ for file_name in file_list:
55
+ test_list = glob.glob(filePath+file_name+"/*")
56
+ for image in test_list:
57
  # image = image
58
  print(image)
59
  lowlight(image)
 
63
  description = "Gradio demo for CMFNet. CMFNet achieves competitive performance on three tasks: image deblurring, image dehazing and image deraindrop. Here, we provide a demo for image deblur. To use it, simply upload your image, or click one of the examples to load them. Reference from: https://huggingface.co/akhaliq"
64
  article = "<p style='text-align: center'><a href='https://' target='_blank'>Compound Multi-branch Feature Fusion for Real Image Restoration</a> | <a href='https://github.com/FanChiMao/CMFNet' target='_blank'>Github Repo</a></p> <center><img src='https://visitor-badge.glitch.me/badge?page_id=52Hz_CMFNet_deblurring' alt='visitor badge'></center>"
65
 
66
+ examples = [['data/test_data//01.jpg'], ['data/test_data//02.jpg'], ['data/test_data//03.jpg'],]
67
  gr.Interface(
68
  inference,
69
  [gr.inputs.Image(type="pil", label="Input")],
data/result/DICM/01.jpg ADDED
data/result/DICM/02.jpg ADDED
data/result/DICM/03.jpg ADDED
data/result/DICM/04.jpg ADDED
data/result/DICM/05.jpg ADDED
data/test_data/DICM/01.jpg ADDED
data/test_data/DICM/02.jpg ADDED
data/test_data/DICM/03.jpg ADDED
data/test_data/DICM/04.jpg ADDED
data/test_data/DICM/05.jpg ADDED