cakiki commited on
Commit
0475e0a
·
1 Parent(s): 1675e3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -17,9 +17,11 @@ ds = load_dataset("SDBiaseval/identities", split="train")
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([index[ix][0]])["image"]
21
- neighbor_list = ds.select(index[ix][1:])["image"]
22
- return image, neighbor_list
 
 
23
 
24
  with gr.Blocks() as demo:
25
  gender = gr.Radio(gender_labels, label="Gender label")
 
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([index[ix][0]])["image"][0]
21
+ neighbors = ds.select(index[ix][1:])
22
+ neighbor_images = neighbors["image"]
23
+ neighbor_captions = neighbors["image_path"]
24
+ return image, list(zip(neighbor_images, neighbor_captions))
25
 
26
  with gr.Blocks() as demo:
27
  gender = gr.Radio(gender_labels, label="Gender label")