Use Generator Expressions Instead of List Comprehensions
This commit is contained in:
parent
fcd8254205
commit
752b619e2e
@ -92,7 +92,7 @@ def create_predictor(model_dir=None, model_lang="ch", is_onnx=False):
|
|||||||
|
|
||||||
def _check_image_file(path):
|
def _check_image_file(path):
|
||||||
img_end = {"jpg", "bmp", "png", "jpeg", "rgb", "tif", "tiff"}
|
img_end = {"jpg", "bmp", "png", "jpeg", "rgb", "tif", "tiff"}
|
||||||
return any([path.lower().endswith(e) for e in img_end])
|
return any(path.lower().endswith(e) for e in img_end)
|
||||||
|
|
||||||
|
|
||||||
def get_image_file_list(img_file):
|
def get_image_file_list(img_file):
|
||||||
|
@ -274,7 +274,7 @@ class LDM(InpaintModel):
|
|||||||
get_cache_path_by_url(LDM_DECODE_MODEL_URL),
|
get_cache_path_by_url(LDM_DECODE_MODEL_URL),
|
||||||
get_cache_path_by_url(LDM_ENCODE_MODEL_URL),
|
get_cache_path_by_url(LDM_ENCODE_MODEL_URL),
|
||||||
]
|
]
|
||||||
return all([os.path.exists(it) for it in model_paths])
|
return all(os.path.exists(it) for it in model_paths)
|
||||||
|
|
||||||
@torch.cuda.amp.autocast()
|
@torch.cuda.amp.autocast()
|
||||||
def forward(self, image, mask, config: InpaintRequest):
|
def forward(self, image, mask, config: InpaintRequest):
|
||||||
|
@ -54,7 +54,7 @@ class Manga(InpaintModel):
|
|||||||
get_cache_path_by_url(MANGA_INPAINTOR_MODEL_URL),
|
get_cache_path_by_url(MANGA_INPAINTOR_MODEL_URL),
|
||||||
get_cache_path_by_url(MANGA_LINE_MODEL_URL),
|
get_cache_path_by_url(MANGA_LINE_MODEL_URL),
|
||||||
]
|
]
|
||||||
return all([os.path.exists(it) for it in model_paths])
|
return all(os.path.exists(it) for it in model_paths)
|
||||||
|
|
||||||
def forward(self, image, mask, config: InpaintRequest):
|
def forward(self, image, mask, config: InpaintRequest):
|
||||||
"""
|
"""
|
||||||
|
@ -269,7 +269,7 @@ class ZITS(InpaintModel):
|
|||||||
get_cache_path_by_url(ZITS_STRUCTURE_UPSAMPLE_MODEL_URL),
|
get_cache_path_by_url(ZITS_STRUCTURE_UPSAMPLE_MODEL_URL),
|
||||||
get_cache_path_by_url(ZITS_INPAINT_MODEL_URL),
|
get_cache_path_by_url(ZITS_INPAINT_MODEL_URL),
|
||||||
]
|
]
|
||||||
return all([os.path.exists(it) for it in model_paths])
|
return all(os.path.exists(it) for it in model_paths)
|
||||||
|
|
||||||
def wireframe_edge_and_line(self, items, enable: bool):
|
def wireframe_edge_and_line(self, items, enable: bool):
|
||||||
# 最终向 items 中添加 edge 和 line key
|
# 最终向 items 中添加 edge 和 line key
|
||||||
|
Loading…
Reference in New Issue
Block a user