Ricercar commited on
Commit
29fae55
1 Parent(s): 31f834b

remove nsfw filter option in gallery mode

Browse files
Files changed (1) hide show
  1. pages/Gallery.py +12 -14
pages/Gallery.py CHANGED
@@ -122,7 +122,8 @@ class GalleryApp:
122
  selecters = st.columns([1, 4])
123
 
124
  if 'score_weights' not in st.session_state:
125
- st.session_state.score_weights = [1.0, 0.8, 0.2, 0.8]
 
126
 
127
  # select sort type
128
  with selecters[0]:
@@ -133,7 +134,7 @@ class GalleryApp:
133
  # select other options
134
  with selecters[1]:
135
  if sort_type == 'IDs and Names':
136
- sub_selecters = st.columns([3, 1])
137
  # select sort by
138
  with sub_selecters[0]:
139
  sort_by = st.selectbox('Sort by',
@@ -144,7 +145,7 @@ class GalleryApp:
144
 
145
  else:
146
  # add custom weights
147
- sub_selecters = st.columns([1, 1, 1, 1])
148
 
149
  with sub_selecters[0]:
150
  clip_weight = st.number_input('Clip Score Weight', min_value=-100.0, max_value=100.0, value=1.0, step=0.1, help='the weight for normalized clip score')
@@ -163,13 +164,13 @@ class GalleryApp:
163
  st.session_state.score_weights[1] = round(mcos_weight, 2)
164
  st.session_state.score_weights[2] = round(pop_weight, 2)
165
 
166
- # select threshold
167
- with sub_selecters[continue_idx]:
168
- nsfw_threshold = st.number_input('NSFW Score Threshold', min_value=0.0, max_value=1.0, value=0.8, step=0.01, help='Only show models with nsfw score lower than this threshold, set 1.0 to show all images')
169
- items = items[items['norm_nsfw'] <= nsfw_threshold].reset_index(drop=True)
170
-
171
- # save latest threshold
172
- st.session_state.score_weights[3] = nsfw_threshold
173
 
174
  # # draw a distribution histogram
175
  # if sort_type == 'Scores':
@@ -495,10 +496,7 @@ class GalleryApp:
495
  # refresh_btn = st.button('Refresh', on_click=gallery_space.empty, use_container_width=True)
496
 
497
  with gallery_space.container():
498
- with st.spinner('Loading images...'):
499
- self.gallery_standard(items, col_num, info)
500
-
501
- # st.info("Don't forget to scroll back to top and click the 'Confirm Selection' button to save your selection!!!")
502
 
503
  def submit_actions(self, status, prompt_id):
504
  # remove counter from session state
 
122
  selecters = st.columns([1, 4])
123
 
124
  if 'score_weights' not in st.session_state:
125
+ # st.session_state.score_weights = [1.0, 0.8, 0.2, 0.8]
126
+ st.session_state.score_weights = [1.0, 0.8, 0.2]
127
 
128
  # select sort type
129
  with selecters[0]:
 
134
  # select other options
135
  with selecters[1]:
136
  if sort_type == 'IDs and Names':
137
+ sub_selecters = st.columns([3])
138
  # select sort by
139
  with sub_selecters[0]:
140
  sort_by = st.selectbox('Sort by',
 
145
 
146
  else:
147
  # add custom weights
148
+ sub_selecters = st.columns([1, 1, 1])
149
 
150
  with sub_selecters[0]:
151
  clip_weight = st.number_input('Clip Score Weight', min_value=-100.0, max_value=100.0, value=1.0, step=0.1, help='the weight for normalized clip score')
 
164
  st.session_state.score_weights[1] = round(mcos_weight, 2)
165
  st.session_state.score_weights[2] = round(pop_weight, 2)
166
 
167
+ # # select threshold
168
+ # with sub_selecters[continue_idx]:
169
+ # nsfw_threshold = st.number_input('NSFW Score Threshold', min_value=0.0, max_value=1.0, value=0.8, step=0.01, help='Only show models with nsfw score lower than this threshold, set 1.0 to show all images')
170
+ # items = items[items['norm_nsfw'] <= nsfw_threshold].reset_index(drop=True)
171
+ #
172
+ # # save latest threshold
173
+ # st.session_state.score_weights[3] = nsfw_threshold
174
 
175
  # # draw a distribution histogram
176
  # if sort_type == 'Scores':
 
496
  # refresh_btn = st.button('Refresh', on_click=gallery_space.empty, use_container_width=True)
497
 
498
  with gallery_space.container():
499
+ self.gallery_standard(items, col_num, info)
 
 
 
500
 
501
  def submit_actions(self, status, prompt_id):
502
  # remove counter from session state