Commit
·
8e5358a
1
Parent(s):
a3d2b71
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ ds = load_from_disk("color-sorted")
|
|
| 17 |
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
|
| 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"]]
|
|
|
|
| 17 |
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"]]
|