Ricercar commited on
Commit
3115330
1 Parent(s): 60428a3

add filter to summary page

Browse files
Files changed (2) hide show
  1. css/style.css +1 -1
  2. pages/Summary.py +19 -0
css/style.css CHANGED
@@ -10,7 +10,7 @@ div.row-widget.stRadio > div[role="radiogroup"] > label[data-baseweb="radio"] {
10
  padding-bottom: 3px;
11
  margin: 4px 0px;
12
  border-radius: 0;
13
- border-bottom: 2px solid whitesmoke;
14
  transition: border-bottom-color 0.2s ease 0s;
15
  }
16
 
 
10
  padding-bottom: 3px;
11
  margin: 4px 0px;
12
  border-radius: 0;
13
+ border-bottom: 2px solid rgba(169, 169, 169, 0.3);
14
  transition: border-bottom-color 0.2s ease 0s;
15
  }
16
 
pages/Summary.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import os
2
 
3
  import datasets
@@ -35,6 +36,12 @@ class DashboardApp:
35
  if back_to_ranking:
36
  switch_page('ranking')
37
 
 
 
 
 
 
 
38
  return tag
39
 
40
  def leaderboard(self, tag, db_table):
@@ -129,9 +136,21 @@ class DashboardApp:
129
  # with st.expander(f'**{icon} {model_name}, [{modelVersion_name}](https://civitai.com/models/{model_id}?modelVersionId={modelVersion_id})**, Ranking Score: {winning_times}'):
130
  with st.expander(f'Show Images'):
131
  images = self.promptBook[self.promptBook['modelVersion_id'] == modelVersion_id]['image_id'].values
 
 
 
 
 
 
 
 
 
 
 
132
  # st.write(f'### Images generated with {icon} {model_name}, {modelVersion_name}')
133
  col_num = 4
134
  image_cols = st.columns(col_num)
 
135
  for j in range(len(images)):
136
  with image_cols[j % col_num]:
137
  image = f"https://modelcofferbucket.s3-accelerate.amazonaws.com/{images[j]}.png"
 
1
+ import json
2
  import os
3
 
4
  import datasets
 
36
  if back_to_ranking:
37
  switch_page('ranking')
38
 
39
+ with st.form('overall_feedback'):
40
+ feedback = st.text_area('Please leave your comments here.', key='comment')
41
+ submit_feedback = st.form_submit_button('Submit Feedback')
42
+ if submit_feedback:
43
+ print(feedback)
44
+
45
  return tag
46
 
47
  def leaderboard(self, tag, db_table):
 
136
  # with st.expander(f'**{icon} {model_name}, [{modelVersion_name}](https://civitai.com/models/{model_id}?modelVersionId={modelVersion_id})**, Ranking Score: {winning_times}'):
137
  with st.expander(f'Show Images'):
138
  images = self.promptBook[self.promptBook['modelVersion_id'] == modelVersion_id]['image_id'].values
139
+
140
+ safety_check = st.checkbox('Include potentially unsafe or offensive images', value=False, key=modelVersion_id)
141
+ unsafe_prompts = json.load(open('data/unsafe_prompts.json', 'r'))
142
+ # merge dict values into one list
143
+ unsafe_prompts = [item for sublist in unsafe_prompts.values() for item in sublist]
144
+ unsafe_images = self.promptBook[self.promptBook['prompt_id'].isin(unsafe_prompts)]['image_id'].values
145
+
146
+ if not safety_check:
147
+ # exclude unsafe prompts from images
148
+ images = [image for image in images if image not in unsafe_images]
149
+
150
  # st.write(f'### Images generated with {icon} {model_name}, {modelVersion_name}')
151
  col_num = 4
152
  image_cols = st.columns(col_num)
153
+
154
  for j in range(len(images)):
155
  with image_cols[j % col_num]:
156
  image = f"https://modelcofferbucket.s3-accelerate.amazonaws.com/{images[j]}.png"