sasha HF staff commited on
Commit
3d53c08
1 Parent(s): 0c0c17a

adding images +UI change

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. app.py +23 -8
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  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_5.jpg +0 -0
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. 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
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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
  36. 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
  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. 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
  47. 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
  48. 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
  49. 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
  50. 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
- dict(cl_dct["labels_gender"]),
29
- dict(cl_dct["labels_model"]),
30
- dict(cl_dct["labels_ethnicity"]),
31
  images)
32
 
33
  with gr.Blocks(title=TITLE) as demo:
@@ -42,12 +56,13 @@ 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
- c = gr.Text(label="Model makeup of cluster")
46
- b = gr.Text(label="Gender label makeup of cluster")
47
- d = gr.Text(label="Ethnicity label makeup of cluster")
 
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])
51
 
52
  if __name__ == "__main__":
53
- demo.queue().launch(debug=True)
 
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])
66
 
67
  if __name__ == "__main__":
68
+ demo.queue().launch(share=True)
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