Fediory commited on
Commit
a7404ed
·
1 Parent(s): 2d65752
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -20,7 +20,7 @@ def process_image(input_img,score,model_path,gamma=1.0,alpha_s=1.0,alpha_i=1.0):
20
  if model_path is None:
21
  return input_img,"Please choose a model weights."
22
  torch.set_grad_enabled(False)
23
- eval_net.from_pretrained(model_path)
24
  # eval_net.load_state_dict(torch.load(os.path.join(directory,model_path), map_location=lambda storage, loc: storage))
25
  eval_net.eval()
26
 
@@ -49,16 +49,16 @@ def process_image(input_img,score,model_path,gamma=1.0,alpha_s=1.0,alpha_i=1.0):
49
 
50
  directory = "weights"
51
  pth_files = [
52
- 'HVI-CIDNet-Generalization',
53
- 'HVI-CIDNet-Sony-Total-Dark',
54
- 'HVI-CIDNet-LOL-Blur',
55
- 'HVI-CIDNet-SICE',
56
- 'HVI-CIDNet-LOLv2-real-bestSSIM',
57
- 'HVI-CIDNet-LOLv2-real-bestPSNR',
58
- 'HVI-CIDNet-LOLv2-syn-wperc',
59
- 'HVI-CIDNet-LOLv2-syn-woperc',
60
- 'HVI-CIDNet-LOLv1-wperc',
61
- 'HVI-CIDNet-LOLv1-woperc'
62
  ]
63
 
64
 
@@ -67,7 +67,7 @@ interface = gr.Interface(
67
  inputs=[
68
  gr.Image(label="Low-light Image", type="pil"),
69
  gr.Radio(choices=['Yes','No'],label="Image Score",info="Calculate NIQE, default is \"No\"."),
70
- gr.Radio(choices=pth_files2,label="Model Weights",info="Choose your model. The best models are \"SICE.pth\" and \"generalization.pth\"."),
71
  gr.Slider(0.1,5,label="gamma curve",step=0.01,value=1.0, info="Lower is lighter, best range is [0.5,2.5]."),
72
  gr.Slider(0,2,label="Alpha-s",step=0.01,value=1.0, info="Higher is more saturated."),
73
  gr.Slider(0.1,2,label="Alpha-i",step=0.01,value=1.0, info="Higher is lighter.")
 
20
  if model_path is None:
21
  return input_img,"Please choose a model weights."
22
  torch.set_grad_enabled(False)
23
+ eval_net.from_pretrained("HVI-CIDNet-"+model_path)
24
  # eval_net.load_state_dict(torch.load(os.path.join(directory,model_path), map_location=lambda storage, loc: storage))
25
  eval_net.eval()
26
 
 
49
 
50
  directory = "weights"
51
  pth_files = [
52
+ 'Generalization',
53
+ 'Sony-Total-Dark',
54
+ 'LOL-Blur',
55
+ 'SICE',
56
+ 'LOLv2-real-bestSSIM',
57
+ 'LOLv2-real-bestPSNR',
58
+ 'LOLv2-syn-wperc',
59
+ 'LOLv2-syn-woperc',
60
+ 'LOLv1-wperc',
61
+ 'LOLv1-woperc'
62
  ]
63
 
64
 
 
67
  inputs=[
68
  gr.Image(label="Low-light Image", type="pil"),
69
  gr.Radio(choices=['Yes','No'],label="Image Score",info="Calculate NIQE, default is \"No\"."),
70
+ gr.Radio(choices=pth_files,label="Model Weights",info="Choose your model. The best models are \"SICE.pth\" and \"generalization.pth\"."),
71
  gr.Slider(0.1,5,label="gamma curve",step=0.01,value=1.0, info="Lower is lighter, best range is [0.5,2.5]."),
72
  gr.Slider(0,2,label="Alpha-s",step=0.01,value=1.0, info="Higher is more saturated."),
73
  gr.Slider(0.1,2,label="Alpha-i",step=0.01,value=1.0, info="Higher is lighter.")