Anonymous Authors
commited on
Commit
·
14b962b
1
Parent(s):
aad9fb1
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ nos = [1,2,3,4,5,6,7,8,9,10]
|
|
14 |
|
15 |
ds = load_from_disk("color-sorted")
|
16 |
|
17 |
-
def
|
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]
|
@@ -28,7 +28,7 @@ def get_nearest_64(gender, ethnicity, model, no):
|
|
28 |
|
29 |
with gr.Blocks() as demo:
|
30 |
gr.Markdown("# Colorfulness Nearest Neighbors Explorer")
|
31 |
-
gr.Markdown("###
|
32 |
gr.Markdown("#### Choose one of the generated identity images to see its nearest neighbors according to colorfulness")
|
33 |
with gr.Row():
|
34 |
with gr.Column():
|
@@ -41,5 +41,5 @@ with gr.Blocks() as demo:
|
|
41 |
with gr.Row():
|
42 |
image = gr.Image()
|
43 |
gallery = gr.Gallery().style(grid=4)
|
44 |
-
button.click(
|
45 |
demo.launch()
|
|
|
14 |
|
15 |
ds = load_from_disk("color-sorted")
|
16 |
|
17 |
+
def get_nearest(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]
|
|
|
28 |
|
29 |
with gr.Blocks() as demo:
|
30 |
gr.Markdown("# Colorfulness Nearest Neighbors Explorer")
|
31 |
+
gr.Markdown("### Colorfulness 1-D index of the _identities_ dataset of images generated by 3 models")
|
32 |
gr.Markdown("#### Choose one of the generated identity images to see its nearest neighbors according to colorfulness")
|
33 |
with gr.Row():
|
34 |
with gr.Column():
|
|
|
41 |
with gr.Row():
|
42 |
image = gr.Image()
|
43 |
gallery = gr.Gallery().style(grid=4)
|
44 |
+
button.click(get_nearest, inputs=[gender, ethnicity, model, no], outputs=[image, gallery])
|
45 |
demo.launch()
|