Spaces:
Running
Running
from datetime import datetime | |
import streamlit as st | |
import random | |
import time | |
from streamlit_extras.switch_page_button import switch_page | |
def login(): | |
# skip customize user name for debug mode | |
with st.form("user_login"): | |
st.write('## Enter Your Name to Start the Session') | |
user_id = st.text_input( | |
"Enter your name ๐", | |
label_visibility='collapsed', | |
disabled=False, | |
placeholder='anonymous', | |
) | |
st.write('You can leave it blank to be anonymous.') | |
# Every form must have a submit button. | |
submitted = st.form_submit_button("Start") | |
if submitted: | |
save_user_id(user_id) | |
switch_page("gallery") | |
def save_user_id(user_id): | |
print(user_id) | |
if not user_id: | |
user_id = 'anonymous' + str(random.randint(0, 100000)) | |
st.session_state.user_id = [user_id, datetime.now().strftime("%Y-%m-%d %H:%M:%S")] | |
def logout(): | |
st.session_state.pop('user_id', None) | |
st.session_state.pop('selected_dict', None) | |
st.session_state.pop('score_weights', None) | |
def info(): | |
with st.sidebar: | |
st.write('## About') | |
st.write( | |
"This is an web application to collect personal preference to images synthesised by generative models fine-tuned on stable diffusion. \ | |
**You might consider it as a tool for quickly digging out the most suitable text-to-image generation model for you from [civitai](https://civitai.com/).**" | |
) | |
st.write( | |
"After you picking images from gallery page, and ranking them in the ranking page, you will be able to see a dashboard showing your preferred models in the summary page, **with download links of the models ready to use in [Automatic1111 webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui)!**" | |
) | |
if __name__ == '__main__': | |
# print(st.source_util.get_pages('Home.py')) | |
st.set_page_config(page_title="Login", page_icon="๐ ", layout="wide") | |
info() | |
st.write('A Research by [MAPS Lab](https://whongyi.github.io/MAPS-research), [NYU Shanghai](https://shanghai.nyu.edu)') | |
st.title("๐ Welcome to GEMRec Gallery Webapp!") | |
# st.info("Getting obsessed with tons of different text-to-image generation models available online? \n \ | |
# Want to find the most suitable one for your taste? \n \ | |
# **GEMRec** is here to help you!" | |
# ) | |
st.write('### Getting obsessed with tons of different text-to-image generation models available online? Want to find the most suitable one for your taste?') | |
st.write('**GEMRec** is here to help you! Try it out now ๐!') | |
if 'user_id' not in st.session_state: | |
login() | |
else: | |
st.write(f"You have already logged in as `{st.session_state.user_id[0]}`") | |
st.button('Log out', on_click=logout) | |
st.write('---') | |
st.write('## FAQ') | |
with st.expander(label='**๐ค How to use this webapp?**'): | |
st.write('### Check out the demo video below') | |
st.video('https://youtu.be/EjjCoeUSZF0') | |
st.caption('Interface shown in this video demo might be a bit different from the current webapp because of further updates, but the basic idea is the same.') | |
with st.expander(label='**โน๏ธ What is GEMRec project?**'): | |
st.write('### About GEMRec') | |
st.write("**GE**nerative **M**odel **Rec**ommendation (**GEMRec**) is a research project by [MAPS Lab](https://github.com/MAPS-research), NYU Shanghai.") | |
st.write('### Our Task') | |
st.write('Given a userโs preference on a set of generated images, we aim to recommend the most preferred generative model for the user.') | |
st.write('### Our Approach') | |
st.write('We propose a two-stage framework, which contains prompt-model retrival and generated item ranking. :red[Your participation in this web application will help us to improve our framework and to further our research on personalization.]') | |
st.write('### Key Contributions') | |
st.write('1. We propose a two-stage framework to approach the Generative Model Recommendation problem. Our framework allows end-users to effectively explore a diverse set of generative models to understand their expressiveness. It also allows system developers to elicit user preferences for items generated from personalized prompts.') | |
st.write('2. We release GEMRec-18K, a dense prompt-model interaction dataset that consists of 18K images generated by pairing 200 generative models with 90 prompts collected from real-world usages, accompanied by detailed metadata and generation configurations. This dataset builds the cornerstone for exploring Generative Recommendation and can be useful for other tasks related to understanding generative models') | |
st.write('3. We take the first step in examining evaluation metrics for personalized image generations and identify several limitations in existing metrics. We propose a weighted metric that is more suitable for the task and opens up directions for future improvements in model training and evaluations.') | |
with st.expander(label='**๐ป Where can I find the paper and dataset?**'): | |
st.write('### Paper') | |
st.write('Arxiv: [Towards Personalized Prompt-Model Retrieval for Generative Recommendation](https://arxiv.org/abs/2308.02205)') | |
st.write('### GEMRec-18K Dataset') | |
st.write('Image dataset: https://huggingface.co/datasets/MAPS-research/GEMRec-PromptBook \n \ | |
Model dataset: https://huggingface.co/datasets/MAPS-research/GEMRec-Roster') | |
st.write('### Code') | |
st.write('Github: https://github.com/maps-research/gemrec') |