Spaces:
Runtime error
Runtime error
sasha_ui
#1
by
sasha
HF staff
- opened
This view is limited to 50 files because it contains too many changes.
See the raw diff here.
- app.py +22 -7
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_1.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_10.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_2.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_3.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_4.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_5.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_6.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_7.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_8.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_9.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_1.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_10.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_2.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_3.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_4.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_5.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_6.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_7.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_8.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_9.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_1.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_10.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_2.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_3.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_4.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_5.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_6.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_7.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_8.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_9.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_1.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_10.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_2.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_3.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_4.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_5.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_6.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_7.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_8.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_9.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_1.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_10.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_2.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_3.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_4.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_5.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_6.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_7.jpg +0 -0
- identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_8.jpg +0 -0
app.py
CHANGED
@@ -2,6 +2,8 @@ import json
|
|
2 |
import gradio as gr
|
3 |
import os
|
4 |
from PIL import Image
|
|
|
|
|
5 |
|
6 |
TITLE = "Diffusion Faces Cluster Explorer"
|
7 |
clusters_12 = json.load(open("clusters/id_all_blip_clusters_12.json"))
|
@@ -23,11 +25,23 @@ def show_cluster(cl_id, num_clusters):
|
|
23 |
images = []
|
24 |
for i in range(6):
|
25 |
img_path = "/".join([st.replace("/", "") for st in cl_dct['img_path_list'][i].split("//")][3:])
|
26 |
-
images.append((Image.open(os.path.join("identities-images", img_path)), "_".join([img_path.split("/")[0], img_path.split("/")[-1]])))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
return (len(cl_dct['img_path_list']),
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
images)
|
32 |
|
33 |
with gr.Blocks(title=TITLE) as demo:
|
@@ -42,9 +56,10 @@ with gr.Blocks(title=TITLE) as demo:
|
|
42 |
with gr.Column():
|
43 |
cluster_id = gr.Slider(minimum=0, maximum=num_clusters.value-1, step=1, value=0, label="Click to move between clusters")
|
44 |
a = gr.Text(label="Number of images")
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
48 |
demo.load(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a,b,c,d, gallery])
|
49 |
num_clusters.change(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a,b,c,d, gallery])
|
50 |
cluster_id.change(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a,b,c,d, gallery])
|
|
|
2 |
import gradio as gr
|
3 |
import os
|
4 |
from PIL import Image
|
5 |
+
import plotly.graph_objects as go
|
6 |
+
import plotly.express as px
|
7 |
|
8 |
TITLE = "Diffusion Faces Cluster Explorer"
|
9 |
clusters_12 = json.load(open("clusters/id_all_blip_clusters_12.json"))
|
|
|
25 |
images = []
|
26 |
for i in range(6):
|
27 |
img_path = "/".join([st.replace("/", "") for st in cl_dct['img_path_list'][i].split("//")][3:])
|
28 |
+
images.append((Image.open(os.path.join("identities-images", img_path)), "_".join([img_path.split("/")[0], img_path.split("/")[-1]]).replace('Photo_portrait_of_an_','').replace('Photo_portrait_of_a_','').replace('SD_v2_random_seeds_identity_','(SD v.2) ').replace('dataset-identities-dalle2_','(Dall-E 2) ').replace('SD_v1.4_random_seeds_identity_','(SD v.1.4) ').replace('_',' ')))
|
29 |
+
model_fig = go.Figure()
|
30 |
+
model_fig.add_trace(go.Bar(x=list(dict(cl_dct["labels_model"]).keys()),
|
31 |
+
y=list(dict(cl_dct["labels_model"]).values()),
|
32 |
+
marker_color=px.colors.qualitative.G10))
|
33 |
+
gender_fig = go.Figure()
|
34 |
+
gender_fig.add_trace(go.Bar(x=list(dict(cl_dct["labels_gender"]).keys()),
|
35 |
+
y=list(dict(cl_dct["labels_gender"]).values()),
|
36 |
+
marker_color=px.colors.qualitative.G10))
|
37 |
+
ethnicity_fig = go.Figure()
|
38 |
+
ethnicity_fig.add_trace(go.Bar(x=list(dict(cl_dct["labels_ethnicity"]).keys()),
|
39 |
+
y=list(dict(cl_dct["labels_ethnicity"]).values()),
|
40 |
+
marker_color=px.colors.qualitative.G10))
|
41 |
return (len(cl_dct['img_path_list']),
|
42 |
+
gender_fig,
|
43 |
+
model_fig,
|
44 |
+
ethnicity_fig,
|
45 |
images)
|
46 |
|
47 |
with gr.Blocks(title=TITLE) as demo:
|
|
|
56 |
with gr.Column():
|
57 |
cluster_id = gr.Slider(minimum=0, maximum=num_clusters.value-1, step=1, value=0, label="Click to move between clusters")
|
58 |
a = gr.Text(label="Number of images")
|
59 |
+
with gr.Row():
|
60 |
+
c = gr.Plot(label="Model makeup of cluster")
|
61 |
+
b = gr.Plot(label="Gender label makeup of cluster")
|
62 |
+
d = gr.Plot(label="Ethnicity label makeup of cluster")
|
63 |
demo.load(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a,b,c,d, gallery])
|
64 |
num_clusters.change(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a,b,c,d, gallery])
|
65 |
cluster_id.change(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a,b,c,d, gallery])
|
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_1.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_10.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_2.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_3.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_4.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_5.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_6.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_7.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_8.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_man_at_work/Photo_portrait_of_a_Black_man_at_work_9.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_1.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_10.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_2.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_3.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_4.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_5.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_6.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_7.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_8.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_non-binary_person_at_work/Photo_portrait_of_a_Black_non-binary_person_at_work_9.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_1.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_10.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_2.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_3.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_4.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_5.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_6.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_7.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_8.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_person_at_work/Photo_portrait_of_a_Black_person_at_work_9.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_1.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_10.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_2.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_3.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_4.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_5.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_6.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_7.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_8.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Black_woman_at_work/Photo_portrait_of_a_Black_woman_at_work_9.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_1.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_10.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_2.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_3.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_4.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_5.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_6.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_7.jpg
ADDED
identities-images/SD_v1.4_random_seeds_identity/Photo_portrait_of_a_Caucasian_man_at_work/Photo_portrait_of_a_Caucasian_man_at_work_8.jpg
ADDED