Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,8 +11,7 @@ def min_dim_to_size(img, size = 512):
|
|
| 11 |
h, w = img.size
|
| 12 |
ratio = size / max(h, w)
|
| 13 |
h, w = map(lambda x: int(x * ratio), [h, w])
|
| 14 |
-
return ( ratio ,img.resize((
|
| 15 |
-
#return ( ratio ,img.resize((h, w)) )
|
| 16 |
|
| 17 |
#ratio_size = 512
|
| 18 |
#ratio, img_rs = min_dim_to_size(img, ratio_size)
|
|
@@ -32,7 +31,7 @@ def swap_gallery(im, images):
|
|
| 32 |
imagehash.average_hash(Image.open(imm["name"])) - im_hash, reverse = False)
|
| 33 |
return list(map(lambda x: x["name"], t2_list))
|
| 34 |
|
| 35 |
-
def lexica(prompt, limit_size = 128, ratio_size =
|
| 36 |
lex = Lexica(query=prompt).images()
|
| 37 |
lex = lex[:limit_size]
|
| 38 |
lex = list(map(lambda ele: Image.open(
|
|
|
|
| 11 |
h, w = img.size
|
| 12 |
ratio = size / max(h, w)
|
| 13 |
h, w = map(lambda x: int(x * ratio), [h, w])
|
| 14 |
+
return ( ratio ,img.resize((h, w)) )
|
|
|
|
| 15 |
|
| 16 |
#ratio_size = 512
|
| 17 |
#ratio, img_rs = min_dim_to_size(img, ratio_size)
|
|
|
|
| 31 |
imagehash.average_hash(Image.open(imm["name"])) - im_hash, reverse = False)
|
| 32 |
return list(map(lambda x: x["name"], t2_list))
|
| 33 |
|
| 34 |
+
def lexica(prompt, limit_size = 128, ratio_size = 512):
|
| 35 |
lex = Lexica(query=prompt).images()
|
| 36 |
lex = lex[:limit_size]
|
| 37 |
lex = list(map(lambda ele: Image.open(
|