import random
import string
from pydantic import BaseModel
from typing import List, Optional
from colablib.utils import config_utils
from colablib.colored_print import cprint, print_line
from colablib.utils.git_utils import validate_repo
def configure_ui_settings(ui_config_file: str):
config = config_utils.read_config(ui_config_file)
preset_config = ui_preset_config()
for key in ["txt2img", "img2img"]:
for subkey, value in preset_config.items():
config[f"{key}/{subkey}"] = value
@title ## Start Cagliostro Colab UI
import random import string from pydantic import BaseModel from typing import List, Optional from colablib.utils import config_utils from colablib.colored_print import cprint, print_line from colablib.utils.git_utils import validate_repo
%store -r
################################
COLAB ARGUMENTS GOES HERE
################################
@markdown ### Alternative Tunnel
@markdown > Recommended Tunnels:
ngrok
>gradio
>cloudflared
>remotemoe
>localhostrun
>googleusercontent
select_tunnel = "multiple" # @param ['gradio', 'multiple','cloudflared', 'localhostrun', 'remotemoe', "googleusercontent"]
@markdown > Get your
ngrok_token
herengrok_token = "2RZ1hgOyiVHaNK4X4aY6dxu23pH_kAuj6owhSMV9j8dP32rw" # @param {type: 'string'} ngrok_region = "us" # @param ["us", "eu", "au", "ap", "sa", "jp", "in"]
@markdown ### UI/UX Config
select_theme = "minimal_orange" # @param ['moonlight', 'ogxRed', 'fun', 'ogxCyan', 'ogxCyanInvert', 'ogxBGreen', 'default_orange', 'tron2', 'd-230-52-94', 'minimal', 'ogxRedYellow', 'retrog', 'ogxRedPurple', 'ogxGreen', 'tron', 'default_cyan', 'default', 'backup', 'minimal_orange', 'Golde']
@markdown Set
use_preset
for using default prompt, resolution, sampler, and other settingsuse_presets = True # @param {type: 'boolean'}
@markdown ### Arguments
use_gradio_auth = False # @param {type: 'boolean'} accelerator = "opt-sdp-attention" # @param ['xformers', 'opt-sdp-attention', 'opt-sdp-no-mem-attention', 'opt-split-attention'] auto_select_model = False # @param {type: 'boolean'} auto_select_vae = True # @param {type: 'boolean'} additional_arguments = "--lowram --theme dark --no-half-vae" #@param {type: 'string'}
GRADIO AUTH
user = "cagliostro" password = "".join(random.choices(string.ascii_letters + string.digits, k=6))
def change_theme(filename): themes_folder = os.path.join(repo_dir, "extensions-builtin", "sd_theme_editor", "themes") themes_file = os.path.join(themes_folder, f"{filename}.css")
def is_valid(valid_dir, file_types): return [f for f in os.listdir(valid_dir) if f.endswith(file_types)]
def auto_select_file(valid_dir, config_key, file_types): valid_files = is_valid(valid_dir, file_types) if valid_files: file_path = random.choice(valid_files) if os.path.exists(os.path.join(valid_dir, file_path)): config = config_utils.read_config(config_file) config[config_key] = file_path config_utils.write_config(config_file, config) return file_path else: return None
def ui_preset_config(): global default_upscaler, default_sampler_v2
def configure_main_settings(config_file: str, lora_dir: str, use_presets: bool, ui_config_file: str): config = config_utils.read_config(config_file)
def configure_ui_settings(ui_config_file: str): config = config_utils.read_config(ui_config_file) preset_config = ui_preset_config() for key in ["txt2img", "img2img"]: for subkey, value in preset_config.items(): config[f"{key}/{subkey}"] = value
def is_dir_exist(cloned_dir, original_dir): if os.path.exists(cloned_dir): return cloned_dir else: return original_dir
def parseargs(config): args = "" for k, v in config.items(): if k.startswith(""): args += f'"{v}" ' elif isinstance(v, str): args += f'--{k}="{v}" ' elif isinstance(v, bool) and v: args += f"--{k} " elif isinstance(v, float) and not isinstance(v, bool): args += f"--{k}={v} " elif isinstance(v, int) and not isinstance(v, bool): args += f"--{k}={v} "
def main(): global auto_select_model, auto_select_vae
main()
IndexError Traceback (most recent call last) in <cell line: 236>()
234 get_ipython().system('{final_args}')
235
--> 236 main()
1 frames in change_theme(filename)
40
41 style_config = config_utils.read_config(style_path)
---> 42 style_contents = style_config.split("/BREAKPOINT_CSS_CONTENT/")[1]
43
44 theme_config = config_utils.read_config(themes_file)
IndexError: list index out of range
does anybody know how to solve this problem plz help