Anonymous Authors
commited on
Commit
·
f4ad3a9
1
Parent(s):
4925660
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ def get_nearest_64(gender, ethnicity, model, no):
|
|
18 |
df = ds.remove_columns(["image","image_path"]).to_pandas()
|
19 |
ix = df.loc[(df['ethnicity'] == ethnicity) & (df['gender'] == gender) & (df['no'] == no) & (df['model'] == model)].index[0]
|
20 |
image = ds.select([ix])["image"][0]
|
21 |
-
neighbors = ds.select(max(ix-10, 0), min(ix+10, len(ds)-1))
|
22 |
neighbor_images = neighbors["image"]
|
23 |
neighbor_captions = [caption.split("/")[-1] for caption in neighbors["image_path"]]
|
24 |
neighbor_captions = [' '.join(caption.split("_")[4:-3]) for caption in neighbor_captions]
|
|
|
18 |
df = ds.remove_columns(["image","image_path"]).to_pandas()
|
19 |
ix = df.loc[(df['ethnicity'] == ethnicity) & (df['gender'] == gender) & (df['no'] == no) & (df['model'] == model)].index[0]
|
20 |
image = ds.select([ix])["image"][0]
|
21 |
+
neighbors = ds.select(range(max(ix-10, 0), min(ix+10, len(ds)-1)))
|
22 |
neighbor_images = neighbors["image"]
|
23 |
neighbor_captions = [caption.split("/")[-1] for caption in neighbors["image_path"]]
|
24 |
neighbor_captions = [' '.join(caption.split("_")[4:-3]) for caption in neighbor_captions]
|