Ricercar commited on
Commit
57256d1
โ€ข
1 Parent(s): e741c3c

add default expand

Browse files
Files changed (2) hide show
  1. Home.py +1 -1
  2. pages/Gallery.py +11 -3
Home.py CHANGED
@@ -74,7 +74,7 @@ if __name__ == '__main__':
74
  st.set_page_config(page_title="Login", page_icon="๐Ÿ ", layout="wide")
75
  info()
76
  st.write('A Research by [MAPS Lab](https://whongyi.github.io/MAPS-research), [NYU Shanghai](https://shanghai.nyu.edu)')
77
- st.title("๐Ÿ™Œ Welcome to GEMRec Gallery Webapp!")
78
  # st.info("Getting obsessed with tons of different text-to-image generation models available online? \n \
79
  # Want to find the most suitable one for your taste? \n \
80
  # **GEMRec** is here to help you!"
 
74
  st.set_page_config(page_title="Login", page_icon="๐Ÿ ", layout="wide")
75
  info()
76
  st.write('A Research by [MAPS Lab](https://whongyi.github.io/MAPS-research), [NYU Shanghai](https://shanghai.nyu.edu)')
77
+ st.title("๐Ÿ™Œ Welcome to GEMRec Gallery!")
78
  # st.info("Getting obsessed with tons of different text-to-image generation models available online? \n \
79
  # Want to find the most suitable one for your taste? \n \
80
  # **GEMRec** is here to help you!"
pages/Gallery.py CHANGED
@@ -372,14 +372,22 @@ class GalleryApp:
372
  def checkout_mode(self, tag, items):
373
  # st.write(items)
374
  if len(items) > 0:
375
- for prompt_id in items['prompt_id'].unique():
 
 
376
  prompt = items[items['prompt_id'] == prompt_id]['prompt'].unique()[0]
377
- default_expand = True if st.session_state.gallery_focus['prompt'] == prompt else False
 
 
 
 
 
 
 
378
  with st.expander(f'**{prompt}**', expanded=default_expand):
379
  # st.caption('select info to show')
380
  checkout_panel = st.columns([5, 3])
381
  with checkout_panel[0]:
382
- pass
383
  info = st.multiselect('Show Info',
384
  ['model_name', 'model_id', 'modelVersion_name', 'modelVersion_id',
385
  'total_score', 'model_download_count', 'clip_score', 'mcos_score',
 
372
  def checkout_mode(self, tag, items):
373
  # st.write(items)
374
  if len(items) > 0:
375
+ prompt_ids = items['prompt_id'].unique()
376
+ for i in range(len(prompt_ids)):
377
+ prompt_id = prompt_ids[i]
378
  prompt = items[items['prompt_id'] == prompt_id]['prompt'].unique()[0]
379
+ # default_expand = True if st.session_state.gallery_focus['prompt'] == prompt else False
380
+ if tag == st.session_state.gallery_focus['tag'] and prompt == st.session_state.gallery_focus['prompt']:
381
+ default_expand = True
382
+ elif tag != st.session_state.gallery_focus['tag'] and i==0:
383
+ default_expand = True
384
+ else:
385
+ default_expand = False
386
+
387
  with st.expander(f'**{prompt}**', expanded=default_expand):
388
  # st.caption('select info to show')
389
  checkout_panel = st.columns([5, 3])
390
  with checkout_panel[0]:
 
391
  info = st.multiselect('Show Info',
392
  ['model_name', 'model_id', 'modelVersion_name', 'modelVersion_id',
393
  'total_score', 'model_download_count', 'clip_score', 'mcos_score',