Spaces:
Runtime error
Runtime error
Anonymous Authors
commited on
Commit
·
6653de4
1
Parent(s):
f946972
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ def show_cluster(cl_id, num_clusters):
|
|
21 |
img_path = os.path.join("identities-images", img_path)
|
22 |
images.append(Image.open(img_path))
|
23 |
return (len(cl_dct['img_path_list']),
|
24 |
-
|
25 |
dict(cl_dct["labels_model"]),
|
26 |
dict(cl_dct["labels_ethnicity"]),
|
27 |
images)
|
@@ -32,14 +32,15 @@ with gr.Blocks() as demo:
|
|
32 |
with gr.Row():
|
33 |
num_clusters = gr.Radio([12, 24, 48], label="number of clusters")
|
34 |
cluster_id = gr.Number(precision=0, label="cluster id")
|
35 |
-
|
|
|
36 |
with gr.Column():
|
37 |
a = gr.Text(label="Number of items in cluster")
|
38 |
with gr.Row():
|
39 |
c = gr.Text(label="Model makeup of cluster")
|
40 |
b = gr.Markdown(label="Gender label makeup of cluster")
|
41 |
d = gr.Text(label="Ethnicity label makeup of cluster")
|
42 |
-
|
43 |
button.click(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a,b,c,d, gallery])
|
44 |
# demo = gr.Interface(fn=show_cluster, inputs=[gr.Slider(0, 50), gr.Radio([12, 24, 48])], outputs=["text", "text", "text", "text", gr.Gallery()])
|
45 |
demo.launch(debug=True)
|
|
|
21 |
img_path = os.path.join("identities-images", img_path)
|
22 |
images.append(Image.open(img_path))
|
23 |
return (len(cl_dct['img_path_list']),
|
24 |
+
dict(cl_dct["labels_gender"]),
|
25 |
dict(cl_dct["labels_model"]),
|
26 |
dict(cl_dct["labels_ethnicity"]),
|
27 |
images)
|
|
|
32 |
with gr.Row():
|
33 |
num_clusters = gr.Radio([12, 24, 48], label="number of clusters")
|
34 |
cluster_id = gr.Number(precision=0, label="cluster id")
|
35 |
+
gallery = gr.Gallery(label="Most representative images in cluster").style(grid=6)
|
36 |
+
button = gr.Button(value="Go")
|
37 |
with gr.Column():
|
38 |
a = gr.Text(label="Number of items in cluster")
|
39 |
with gr.Row():
|
40 |
c = gr.Text(label="Model makeup of cluster")
|
41 |
b = gr.Markdown(label="Gender label makeup of cluster")
|
42 |
d = gr.Text(label="Ethnicity label makeup of cluster")
|
43 |
+
|
44 |
button.click(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a,b,c,d, gallery])
|
45 |
# demo = gr.Interface(fn=show_cluster, inputs=[gr.Slider(0, 50), gr.Radio([12, 24, 48])], outputs=["text", "text", "text", "text", gr.Gallery()])
|
46 |
demo.launch(debug=True)
|