Spaces:
Runtime error
Runtime error
Anonymous Authors
commited on
Commit
·
7c714e1
1
Parent(s):
f63d294
Update app.py
Browse files
app.py
CHANGED
@@ -22,5 +22,19 @@ def show_cluster(cl_id, num_clusters):
|
|
22 |
images.append(Image.open(img_path))
|
23 |
return len(cl_dct['img_path_list']),cl_dct["labels_gender"], cl_dct["labels_model"], cl_dct["labels_ethnicity"], images
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
demo.launch(debug=True)
|
|
|
22 |
images.append(Image.open(img_path))
|
23 |
return len(cl_dct['img_path_list']),cl_dct["labels_gender"], cl_dct["labels_model"], cl_dct["labels_ethnicity"], images
|
24 |
|
25 |
+
with gr.Blocks() as demo:
|
26 |
+
gr.Markdown("# Cluster Explorer")
|
27 |
+
gr.HTML("""<span style="color:red">⚠️ <b>DISCLAIMER: the images displayed by this tool were generated by text-to-image models and may depict offensive stereotypes or contain explicit content.</b></span>""")
|
28 |
+
with gr.Row():
|
29 |
+
num_clusters = gr.Radio([12, 24, 48])
|
30 |
+
cluster_id = gr.Slider(0, len(num_clusters))
|
31 |
+
button = gr.Button(value="Go")
|
32 |
+
with gr.Column():
|
33 |
+
a = gr.Text()
|
34 |
+
b = gr.Text()
|
35 |
+
c = gr.Text()
|
36 |
+
d = gr.Text()
|
37 |
+
gallery = gr.Gallery().style(grid=4)
|
38 |
+
button.click(fn=show_cluster, inputs=[num_clusters, cluster_id], outputs=[gr.Text(),gr.Text(),gr.Text(),gr.Text(), gallery])
|
39 |
+
# demo = gr.Interface(fn=show_cluster, inputs=[gr.Slider(0, 50), gr.Radio([12, 24, 48])], outputs=["text", "text", "text", "text", gr.Gallery()])
|
40 |
demo.launch(debug=True)
|