plugins add dropdown menu; realesrgan support 2x 4x

This commit is contained in:
Qing
2023-03-25 13:39:56 +08:00
parent a5997e9332
commit 003a104406
9 changed files with 877 additions and 149 deletions

View File

@@ -1,6 +1,7 @@
from enum import Enum
import cv2
from loguru import logger
from lama_cleaner.helper import download_model
@@ -83,8 +84,11 @@ class RealESRGANUpscaler:
def __call__(self, rgb_np_img, files, form):
bgr_np_img = cv2.cvtColor(rgb_np_img, cv2.COLOR_RGB2BGR)
scale = 4
return self.forward(bgr_np_img, scale)
scale = float(form['upscale'])
logger.info(f"RealESRGAN input shape: {bgr_np_img.shape}, scale: {scale}")
result = self.forward(bgr_np_img, scale)
logger.info(f"RealESRGAN output shape: {result.shape}")
return result
def forward(self, bgr_np_img, scale: float):
# 输出是 BGR