Spaces:
Sleeping
Sleeping
fix checkbox
Browse files
app.py
CHANGED
@@ -97,7 +97,7 @@ class GalleryApp:
|
|
97 |
idx = prompts.index(prompt)
|
98 |
prompt_full = ', '.join(original_prompts[idx].split(', ')[:4]) + ', ' + prompt
|
99 |
else:
|
100 |
-
prompt_full = st.selectbox('Select prompt', original_prompts)
|
101 |
|
102 |
prompt_id = items[items['prompt'] == prompt_full]['prompt_id'].unique()[0]
|
103 |
items = items[items['prompt_id'] == prompt_id].reset_index(drop=True)
|
@@ -159,7 +159,7 @@ class GalleryApp:
|
|
159 |
elif filter == 'Unchecked':
|
160 |
items = items[items['checked'] == False].reset_index(drop=True)
|
161 |
|
162 |
-
with st.form(key='
|
163 |
buttons = st.columns([1, 1, 1])
|
164 |
with buttons[0]:
|
165 |
submit = st.form_submit_button('Save selections', on_click=self.save_checked, use_container_width=True, type='primary')
|
@@ -169,6 +169,10 @@ class GalleryApp:
|
|
169 |
submit = st.form_submit_button('Reset all selections', on_click=self.reset_all, use_container_width=True)
|
170 |
self.gallery_standard(items, col_num, info)
|
171 |
|
|
|
|
|
|
|
|
|
172 |
def reset_current_prompt(self, prompt_id):
|
173 |
# reset current prompt
|
174 |
self.promptBook.loc[self.promptBook['prompt_id'] == prompt_id, 'checked'] = False
|
|
|
97 |
idx = prompts.index(prompt)
|
98 |
prompt_full = ', '.join(original_prompts[idx].split(', ')[:4]) + ', ' + prompt
|
99 |
else:
|
100 |
+
prompt_full = st.selectbox('Select prompt', original_prompts, on_change=self.refresh)
|
101 |
|
102 |
prompt_id = items[items['prompt'] == prompt_full]['prompt_id'].unique()[0]
|
103 |
items = items[items['prompt_id'] == prompt_id].reset_index(drop=True)
|
|
|
159 |
elif filter == 'Unchecked':
|
160 |
items = items[items['checked'] == False].reset_index(drop=True)
|
161 |
|
162 |
+
with st.form(key=f'{prompt_id}', clear_on_submit=False):
|
163 |
buttons = st.columns([1, 1, 1])
|
164 |
with buttons[0]:
|
165 |
submit = st.form_submit_button('Save selections', on_click=self.save_checked, use_container_width=True, type='primary')
|
|
|
169 |
submit = st.form_submit_button('Reset all selections', on_click=self.reset_all, use_container_width=True)
|
170 |
self.gallery_standard(items, col_num, info)
|
171 |
|
172 |
+
def refresh(self):
|
173 |
+
st.experimental_rerun()
|
174 |
+
st.cache_resource.clear()
|
175 |
+
|
176 |
def reset_current_prompt(self, prompt_id):
|
177 |
# reset current prompt
|
178 |
self.promptBook.loc[self.promptBook['prompt_id'] == prompt_id, 'checked'] = False
|