meg HF staff cakiki commited on
Commit
931f769
·
1 Parent(s): f240ca5

Update slider maximum based on select radio button value (#2)

Browse files

- Update slider maximum based on select radio button value (0ecd671b1c5ba5724cd092a37a32733234e7390f)


Co-authored-by: Christopher Akiki <[email protected]>

Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -67,7 +67,8 @@ def show_cluster(cl_id, num_clusters):
67
  gender_fig,gender_description,
68
  model_fig, model_description,
69
  ethnicity_fig,
70
- images)
 
71
 
72
  with gr.Blocks(title=TITLE) as demo:
73
  gr.Markdown(f"# {TITLE}")
@@ -97,9 +98,9 @@ with gr.Blocks(title=TITLE) as demo:
97
  gr.Markdown(f"The 'Model makeup' plot corresponds to the number of images from the cluster that come from each of the TTI systems that we are comparing: Dall-E 2, Stable Diffusion v.1.4. and Stable Diffusion v.2.")
98
  gr.Markdown('The Gender plot shows the number of images based on the input prompts that used the words man, woman, non-binary, and unmarked, which we label "person".')
99
  gr.Markdown(f"The 'Ethnicity label makeup' plot corresponds to the number of images from each of the 18 ethnicities used in the prompts. A blank value means unmarked ethnicity.")
100
- demo.load(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a, b, b_desc, c, c_desc, d, gallery])
101
- num_clusters.change(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a, b, b_desc, c, c_desc, d, gallery])
102
- cluster_id.change(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a, b, b_desc, c, c_desc, d, gallery])
103
 
104
  if __name__ == "__main__":
105
  demo.queue().launch(debug=True)
 
67
  gender_fig,gender_description,
68
  model_fig, model_description,
69
  ethnicity_fig,
70
+ images,
71
+ gr.update(maximum=num_clusters-1))
72
 
73
  with gr.Blocks(title=TITLE) as demo:
74
  gr.Markdown(f"# {TITLE}")
 
98
  gr.Markdown(f"The 'Model makeup' plot corresponds to the number of images from the cluster that come from each of the TTI systems that we are comparing: Dall-E 2, Stable Diffusion v.1.4. and Stable Diffusion v.2.")
99
  gr.Markdown('The Gender plot shows the number of images based on the input prompts that used the words man, woman, non-binary, and unmarked, which we label "person".')
100
  gr.Markdown(f"The 'Ethnicity label makeup' plot corresponds to the number of images from each of the 18 ethnicities used in the prompts. A blank value means unmarked ethnicity.")
101
+ demo.load(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a, b, b_desc, c, c_desc, d, gallery, cluster_id])
102
+ num_clusters.change(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a, b, b_desc, c, c_desc, d, gallery, cluster_id])
103
+ cluster_id.change(fn=show_cluster, inputs=[cluster_id, num_clusters], outputs=[a, b, b_desc, c, c_desc, d, gallery, cluster_id])
104
 
105
  if __name__ == "__main__":
106
  demo.queue().launch(debug=True)