Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,7 @@ from pulid.utils import resize_numpy_image_long, seed_everything
|
|
| 10 |
|
| 11 |
import boto3
|
| 12 |
from botocore.exceptions import ClientError
|
|
|
|
| 13 |
|
| 14 |
torch.set_grad_enabled(False)
|
| 15 |
|
|
@@ -93,10 +94,10 @@ def run(bucket_folder, person_name, req_id):
|
|
| 93 |
id_image = image_paths[0]
|
| 94 |
|
| 95 |
if image_paths is not None:
|
| 96 |
-
id_image = resize_numpy_image_long(image_paths[0], 1024)
|
| 97 |
id_embeddings = pipeline.get_id_embedding(id_image)
|
| 98 |
for i in range(1,len(image_paths)):
|
| 99 |
-
supp_id_image = resize_numpy_image_long(image_paths[i], 1024)
|
| 100 |
supp_id_embeddings = pipeline.get_id_embedding(supp_id_image)
|
| 101 |
id_embeddings = torch.cat(
|
| 102 |
(id_embeddings, supp_id_embeddings if id_mix else supp_id_embeddings[:, :5]), dim=1
|
|
|
|
| 10 |
|
| 11 |
import boto3
|
| 12 |
from botocore.exceptions import ClientError
|
| 13 |
+
from PIL import Image
|
| 14 |
|
| 15 |
torch.set_grad_enabled(False)
|
| 16 |
|
|
|
|
| 94 |
id_image = image_paths[0]
|
| 95 |
|
| 96 |
if image_paths is not None:
|
| 97 |
+
id_image = resize_numpy_image_long(np.array(Image.open(image_paths[0])), 1024)
|
| 98 |
id_embeddings = pipeline.get_id_embedding(id_image)
|
| 99 |
for i in range(1,len(image_paths)):
|
| 100 |
+
supp_id_image = resize_numpy_image_long(np.array(Image.open(image_paths[i])), 1024)
|
| 101 |
supp_id_embeddings = pipeline.get_id_embedding(supp_id_image)
|
| 102 |
id_embeddings = torch.cat(
|
| 103 |
(id_embeddings, supp_id_embeddings if id_mix else supp_id_embeddings[:, :5]), dim=1
|