File size: 1,976 Bytes
d68e244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d14e74
d68e244
7d14e74
a25fae5
 
 
d68e244
 
 
 
 
 
 
 
683e48b
d68e244
 
 
 
 
a25fae5
9735e42
2302f94
9735e42
d68e244
 
f9abe5d
 
b12af9d
d68e244
fda3aed
d68e244
a844295
523f87f
a3c2d69
d68e244
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import gradio as gr
import torch
import torch.nn as nn
import torchvision
import torch.backends.cudnn as cudnn
import torch.optim
import os
import sys
import argparse
import time
import dataloader
import model
import numpy as np
from torchvision import transforms
from PIL import Image
import glob
import time

 
def lowlight(image):
	os.environ['CUDA_VISIBLE_DEVICES']=''
	data_lowlight = Image.open(image)

 

	data_lowlight = (np.asarray(data_lowlight)/255.0)


	data_lowlight = torch.from_numpy(data_lowlight).float()
	data_lowlight = data_lowlight.permute(2,0,1)
	data_lowlight = data_lowlight.cpu().unsqueeze(0)

	DCE_net = model.enhance_net_nopool().cpu()
	DCE_net.load_state_dict(torch.load('Epoch99.pth', map_location=torch.device('cpu')))
	start = time.time()
	_,enhanced_image,_ = DCE_net(data_lowlight)

	end_time = (time.time() - start)
	print(end_time)

	torchvision.utils.save_image(enhanced_image, f'01.png')

	return '01.png'


title = "Zero-Reference Deep Curve Estimation for Low-Light Image Enhancement"
description = "Low-light image enhancement using Zero-DCE model. Full paper: http://openaccess.thecvf.com/content_CVPR_2020/papers/Guo_Zero-Reference_Deep_Curve_Estimation_for_Low-Light_Image_Enhancement_CVPR_2020_paper.pdf"
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/Li-Chongyi/Zero-DCE' target='_blank'>Github Repo</a></p> <center><img src='https://visitor-badge.glitch.me/badge?page_id=52Hz_CMFNet_deblurring' alt='visitor badge'></center>"

examples = [['01.jpg'], ['02.jpg'], ['03.jpg'],]
gr.Interface(
    lowlight,
    [gr.inputs.Image(type="file", label="Input")],
    outputs = "image",
    title=title,
    description=description,
    article=article,
    allow_flagging=False,
    allow_screenshot=False,
    examples=examples
).launch(debug=True)