From d89b019b72b66eda05e66d56493f7d5820100884 Mon Sep 17 00:00:00 2001 From: ZeroCool940711 Date: Mon, 3 Oct 2022 13:14:36 -0700 Subject: [PATCH] Models from the Model Manager are now stored inside the config file. This allow us to have them as global variables inside streamlit and have them unified in a single place. --- configs/webui/webui_streamlit.yaml | 59 +++++++++++++++++++++++++++++- scripts/ModelManager.py | 33 ++++------------- 2 files changed, 65 insertions(+), 27 deletions(-) diff --git a/configs/webui/webui_streamlit.yaml b/configs/webui/webui_streamlit.yaml index 3ae6bfc..7bd5c31 100644 --- a/configs/webui/webui_streamlit.yaml +++ b/configs/webui/webui_streamlit.yaml @@ -317,5 +317,60 @@ textual_inversion: daisi_app: running_on_daisi_io: False -model_manager: - value: 0 \ No newline at end of file +model_manager: + models: + stable_diffusion: + model_name: "Stable Diffusion v1.4" + save_location: "./models/ldm/stable-diffusion-v1" + download_link: "https://huggingface.co/CompVis/stable-diffusion-v-1-4-original" + + gfpgan: + model_name: "GFPGAN v1.4" + save_location: "./models/gfpgan" + download_link: "https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth" + + realesrgan_x4plus: + model_name: "RealESRGAN_x4plus" + save_location: "./models/realesrgan" + download_link: "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth" + + realesrgan_x4plus_anime_6b: + model_name: "RealESRGAN_x4plus_anime_6B" + save_location: "./models/realesrgan" + download_link: "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth" + + waifu_diffusion: + model_name: "Waifu Diffusion v1.2" + save_location: "./models/custom" + download_link: "https://huggingface.co/hakurei/waifu-diffusion" + + waifu-diffusion_pruned: + model_name: "Waifu Diffusion v1.2 Pruned" + save_location: "./models/custom" + download_link: "https://huggingface.co/crumb/pruned-waifu-diffusion" + + trinart_stable_diffusion: + model_name: "TrinArt Stable Diffusion v2" + save_location: "./models/custom" + download_link: "https://huggingface.co/naclbit/trinart_stable_diffusion_v2" + + stable_diffusion_concept_library: + model_name: "Stable Diffusion Concept Library" + save_location: "./models/custom/sd-concepts-library" + download_link: "https://github.com/sd-webui/sd-concepts-library" + + blip_model: + model_name: "Blip Model" + save_location: "./models/blip" + download_link: "https://storage.googleapis.com/sfr-vision-language-research/BLIP/models/model*_base_caption.pth" + + lds_project_file: + model_name: "LDSR `project.yaml`" + save_location: "./models/ldsr" + download_link: "https://heibox.uni-heidelberg.de/f/31a76b13ea27482981b4/?dl=1" + + ldsr_model: + model_name: "LDSR `model.cpkt`" + save_location: "./models/ldsr" + download_link: "https://heibox.uni-heidelberg.de/f/578df07c8fc04ffbadf3/?dl=1" + \ No newline at end of file diff --git a/scripts/ModelManager.py b/scripts/ModelManager.py index 887a559..f72c983 100644 --- a/scripts/ModelManager.py +++ b/scripts/ModelManager.py @@ -20,8 +20,6 @@ from sd_utils import * #other imports -import pandas as pd -from io import StringIO # Temp imports @@ -31,34 +29,19 @@ from io import StringIO def layout(): #search = st.text_input(label="Search", placeholder="Type the name of the model you want to search for.", help="") - - csvString = f""" - ,Stable Diffusion v1.4 , ./models/ldm/stable-diffusion-v1 , https://huggingface.co/CompVis/stable-diffusion-v-1-4-original - ,GFPGAN v1.4 , ./models/gfpgan , https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth - ,RealESRGAN_x4plus , ./models/realesrgan , https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth - ,RealESRGAN_x4plus_anime_6B , ./models/realesrgan , https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth - ,Waifu Diffusion v1.2 , ./models/custom , https://huggingface.co/hakurei/waifu-diffusion - ,Waifu Diffusion v1.2 Pruned , ./models/custom , https://huggingface.co/crumb/pruned-waifu-diffusion - ,TrinArt Stable Diffusion v2 , ./models/custom , https://huggingface.co/naclbit/trinart_stable_diffusion_v2 - ,Stable Diffusion Concept Library , ./models/custom/sd-concepts-library , https://github.com/sd-webui/sd-concepts-library - ,Blip Model , ./models/blip , https://storage.googleapis.com/sfr-vision-language-research/BLIP/models/model*_base_caption.pth - ,LDSR `project.yaml` , ./models/ldsr , https://heibox.uni-heidelberg.de/f/31a76b13ea27482981b4/?dl=1 - ,LDSR `model.cpkt` , ./models/ldsr , https://heibox.uni-heidelberg.de/f/578df07c8fc04ffbadf3/?dl=1 - """ + colms = st.columns((1, 3, 5, 5)) columns = ["№",'Model Name','Save Location','Download Link'] - - # Convert String into StringIO - csvStringIO = StringIO(csvString) - df = pd.read_csv(csvStringIO, sep=",", header=None, names=columns) + + models = st.session_state["defaults"].model_manager.models for col, field_name in zip(colms, columns): # table header col.write(field_name) - - for x, model_name in enumerate(df["Model Name"]): + + for x, model_name in enumerate(models): col1, col2, col3, col4 = st.columns((1, 3, 4, 6)) col1.write(x) # index - col2.write(df['Model Name'][x]) - col3.write(df['Save Location'][x]) - col4.write(df['Download Link'][x]) \ No newline at end of file + col2.write(models[model_name]['model_name']) + col3.write(models[model_name]['save_location']) + col4.write(models[model_name]['download_link']) \ No newline at end of file