Spaces:
Runtime error
Runtime error
Update image_embedder.py
Browse files- image_embedder.py +2 -0
image_embedder.py
CHANGED
|
@@ -26,6 +26,7 @@ import numpy as np
|
|
| 26 |
import torch
|
| 27 |
import torch.nn.functional as F
|
| 28 |
from PIL import Image
|
|
|
|
| 29 |
from huggingface_hub import hf_hub_download
|
| 30 |
|
| 31 |
|
|
@@ -165,6 +166,7 @@ def get_image_embedding(image: Image.Image) -> np.ndarray:
|
|
| 165 |
log.info(f"get_image_embedding: input image size={image.size} mode={image.mode!r}")
|
| 166 |
try:
|
| 167 |
image = image.convert("RGB")
|
|
|
|
| 168 |
image_tensor = _clip_prep(image).unsqueeze(0).to(DEVICE)
|
| 169 |
log.info(f"get_image_embedding: preprocessed tensor shape={tuple(image_tensor.shape)}")
|
| 170 |
|
|
|
|
| 26 |
import torch
|
| 27 |
import torch.nn.functional as F
|
| 28 |
from PIL import Image
|
| 29 |
+
from kuwahara import apply_kuwahara
|
| 30 |
from huggingface_hub import hf_hub_download
|
| 31 |
|
| 32 |
|
|
|
|
| 166 |
log.info(f"get_image_embedding: input image size={image.size} mode={image.mode!r}")
|
| 167 |
try:
|
| 168 |
image = image.convert("RGB")
|
| 169 |
+
image = apply_kuwahara(image)
|
| 170 |
image_tensor = _clip_prep(image).unsqueeze(0).to(DEVICE)
|
| 171 |
log.info(f"get_image_embedding: preprocessed tensor shape={tuple(image_tensor.shape)}")
|
| 172 |
|