Update app.py
Browse files20 unmodified lines21222324252627282930313226 unmodified lines596061626364658 unmodified lines74757677787980818220 unmodified linesimg_tensor = pil_to_tensor(img)return img_tensordef process_img(image, filename):# Select the correct weight file based on the image filename# filename = image.name.split("/")[-1]# if filename in image_to_weights:model_path = image_to_weights[1]checkpoints = torch.load(model_path, map_location=device)model.load_state_dict(checkpoints['params'])model.to(device)26 unmodified linesexamples = [['images/low00772.png'],['images/low00723.png'],['images/low00748.png'],]css = """8 unmodified linesdemo = gr.Interface(fn = process_img,inputs = [gr.Image(type = 'pil', label = 'input')],outputs = [gr.Image(type='pil', label = 'output')],title = title,description = description,20 unmodified lines21222324252627282930313226 unmodified lines5960616263646566678 unmodified lines7677787980818220 unmodified linesimg_tensor = pil_to_tensor(img)return img_tensordef process_img(image, UHD_LL_model):# Select the correct weight file based on the image filename# filename = image.name.split("/")[-1]# if filename in image_to_weights:model_path = image_to_weights[0] if UHD_LL_model else image_to_weights[1]checkpoints = torch.load(model_path, map_location=device)model.load_state_dict(checkpoints['params'])model.to(device)26 unmodified linesexamples = [['images/low00772.png'],['images/low00723.png'],['images/425_UHD_LL.JPG'],['images/1778_UHD_LL.JPG'],['images/1791_UHD_LL.JPG']]css = """8 unmodified linesdemo = gr.Interface(fn = process_img,inputs = [gr.Image(type = 'pil', label = 'input'), 'checkbox'],outputs = [gr.Image(type='pil', label = 'output')],title = title,description = description,
app.py+6-6