Spaces:
Runtime error
Runtime error
Commit ·
e66c262
1
Parent(s): 77abc57
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,16 @@ clusters_by_size = {
|
|
| 16 |
|
| 17 |
def show_cluster(cl_id, num_clusters):
|
| 18 |
cl_dct = clusters_by_size[num_clusters][cl_id]
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
demo = gr.Interface(fn=show_cluster, inputs=[gr.Slider(0, 50), gr.Radio([12, 24, 48])], outputs=["text", "text", "text", "text", "text"])
|
| 22 |
demo.launch(debug=True)
|
|
|
|
| 16 |
|
| 17 |
def show_cluster(cl_id, num_clusters):
|
| 18 |
cl_dct = clusters_by_size[num_clusters][cl_id]
|
| 19 |
+
img_paths = []
|
| 20 |
+
for i in range(5):
|
| 21 |
+
img_path = "/".join([st.replace("/", "") for st in cl_dct['img_path_list'][i].split("//")][3:])
|
| 22 |
+
img_paths.append(img_path)
|
| 23 |
+
return len(cl_dct['img_path_list']),cl_dct["labels_gender"], cl_dct["labels_model"], cl_dct["labels_ethnicity"], img_paths
|
| 24 |
+
|
| 25 |
+
for i in range(5):
|
| 26 |
+
img_path = "/".join([st.replace("/", "") for st in cl_dct['img_path_list'][i].split("//")][3:])
|
| 27 |
+
display(Image.open(pjoin(_DATA_PATH, img_path)).convert('RGB'))
|
| 28 |
+
|
| 29 |
|
| 30 |
demo = gr.Interface(fn=show_cluster, inputs=[gr.Slider(0, 50), gr.Radio([12, 24, 48])], outputs=["text", "text", "text", "text", "text"])
|
| 31 |
demo.launch(debug=True)
|