This commit is contained in:
Art Gourieff 2023-06-19 16:54:18 +07:00 committed by GitHub
parent 3e52982eca
commit 634d1d512a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 11 deletions

View File

@ -23,7 +23,3 @@ def check_batch(x: torch.Tensor) -> torch.Tensor:
x_checked_image = x_samples_ddim_numpy
x = torch.from_numpy(x_checked_image).permute(0, 3, 1, 2)
return x
def convert_to_sd(img: Image) -> Image:
return img

View File

@ -11,7 +11,6 @@ from PIL import Image
import insightface
import onnxruntime
from scripts.cimage import convert_to_sd
from modules.face_restoration import FaceRestoration, restore_faces
from modules.upscaler import Upscaler, UpscalerData
@ -29,10 +28,6 @@ class UpscaleOptions:
restorer_visibility: float = 0.5
def save_image(img: Image, filename: str):
convert_to_sd(img).save(filename)
def cosine_distance(vector1: np.ndarray, vector2: np.ndarray) -> float:
vec1 = vector1.flatten()
vec2 = vector2.flatten()
@ -162,8 +157,7 @@ def swap_face(
if upscale_options is not None:
result_image = upscale_image(result_image, upscale_options)
# save_image(result_image, fn.name)
else:
logger.info("No source face found")
save_image(result_image, fn.name)
result_image.save(fn.name)
return ImageResult(path=fn.name)