Spaces:
Runtime error
Runtime error
allow selection of only one item
Browse files
backend/disentangle_concepts.py
CHANGED
@@ -28,7 +28,9 @@ def get_separation_space(type_bin, annotations, df, samples=200, method='LR', C=
|
|
28 |
else:
|
29 |
col = 'w_vectors'
|
30 |
|
31 |
-
if
|
|
|
|
|
32 |
abstracts = np.array([float(ann) for ann in df[type_bin]])
|
33 |
abstract_idxs = list(np.argsort(abstracts))[:samples]
|
34 |
repr_idxs = list(np.argsort(abstracts))[-samples:]
|
|
|
28 |
else:
|
29 |
col = 'w_vectors'
|
30 |
|
31 |
+
if len(type_bin) == 1:
|
32 |
+
type_bin = type_bin[0]
|
33 |
+
if type(type_bin) == str:
|
34 |
abstracts = np.array([float(ann) for ann in df[type_bin]])
|
35 |
abstract_idxs = list(np.argsort(abstracts))[:samples]
|
36 |
repr_idxs = list(np.argsort(abstracts))[-samples:]
|
pages/3_Oxford_Vases_Disentanglement.py
CHANGED
@@ -143,7 +143,7 @@ else:
|
|
143 |
original_image_vec = annotations['w_vectors'][st.session_state.image_id]
|
144 |
|
145 |
img = generate_original_image(original_image_vec, model, latent_space=st.session_state.space_id)
|
146 |
-
print(ann_df.iloc[st.session_state.image_id, list(ann_df.
|
147 |
top_pred = ann_df.iloc[st.session_state.image_id, list(ann_df.columns) - 'ID'].idxmax()
|
148 |
# input_image = original_image_dict['image']
|
149 |
# input_label = original_image_dict['label']
|
|
|
143 |
original_image_vec = annotations['w_vectors'][st.session_state.image_id]
|
144 |
|
145 |
img = generate_original_image(original_image_vec, model, latent_space=st.session_state.space_id)
|
146 |
+
print(ann_df.iloc[st.session_state.image_id, list(ann_df.columns) - 'ID'])
|
147 |
top_pred = ann_df.iloc[st.session_state.image_id, list(ann_df.columns) - 'ID'].idxmax()
|
148 |
# input_image = original_image_dict['image']
|
149 |
# input_label = original_image_dict['label']
|