diff --git a/README.cn.md b/README.cn.md index cc02f59..f76d821 100644 --- a/README.cn.md +++ b/README.cn.md @@ -19,6 +19,12 @@ Stable Diffusion Webui 扩展Civitai助手,用于更轻松的管理和使用Ci # 使用方法 +## 更新你的SD webui +本扩展需要取到 Extra Network的卡片列表id。**这个是从2023-02-06,才添加到SD webui里面的。** + +所以,如果你用的版本比这个早,你就需要先更新你的SD Webui! + + ## 扫描模型 前往扩展页面"Civitai Helper",有个按钮叫:"Scan Model" diff --git a/README.md b/README.md index 864c81c..c0f8529 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,11 @@ Then reload UI with "Reload UI" Button in Setting tab. Done. # How to Use +## Update Your SD Webui +This extension need to get extra network's cards id. **Which is added to SD webui since 2023-02-06.** + +So, if you are using a version older than this, you need to update your SD Webui! + ## Scanning Models Go to extension tab "Civitai Helper". There is a button called "Scan model". diff --git a/scripts/civitai_helper.py b/scripts/civitai_helper.py index 5fb39e8..33c3e8b 100644 --- a/scripts/civitai_helper.py +++ b/scripts/civitai_helper.py @@ -72,7 +72,7 @@ def on_ui_tabs(): with gr.Column(): gr.Markdown("### Scan Models for Civitai") with gr.Row(): - low_memory_sha_ckb = gr.Checkbox(label="Memory Optimized SHA256", value=low_memory_sha, elem_id="ch_low_memory_sha_ckb") + low_memory_sha_ckb = gr.Checkbox(label="Memory Optimized SHA256", value=low_memory_sha, visible=False, elem_id="ch_low_memory_sha_ckb") max_size_preview_ckb = gr.Checkbox(label="Download Max Size Preview", value=max_size_preview, elem_id="ch_max_size_preview_ckb") skip_nsfw_preview_ckb = gr.Checkbox(label="SKip NSFW Preview images", value=skip_nsfw_preview, elem_id="ch_skip_nsfw_preview_ckb") diff --git a/scripts/lib/model_action_civitai.py b/scripts/lib/model_action_civitai.py index 4b7e33b..a8c2375 100644 --- a/scripts/lib/model_action_civitai.py +++ b/scripts/lib/model_action_civitai.py @@ -29,6 +29,7 @@ def scan_model(low_memory_sha, max_size_preview, skip_nsfw_preview): info_file = base + civitai.suffix + model.info_ext # check info file if not os.path.isfile(info_file): + util.printD("Creating model info for: " + filename) # get model's sha256 hash = util.gen_file_sha256(item, low_memory_sha) diff --git a/scripts/lib/util.py b/scripts/lib/util.py index 3b4bc01..4d91467 100644 --- a/scripts/lib/util.py +++ b/scripts/lib/util.py @@ -12,12 +12,17 @@ def gen_file_sha256(filname, is_low_memory=True): printD("Calculate SHA256") hash_sha256 = hashlib.sha256() with open(filname, "rb") as f: - if is_low_memory: - printD("Using Memory Optimized SHA256") - for chunk in iter(lambda: f.read(4096), b""): - hash_sha256.update(chunk) - else: - hash_sha256.update(f.read()) + # force to use Memory Optimized SHA256 + # In case people don't understand this and uncheck it then stuck their system + printD("Using Memory Optimized SHA256") + for chunk in iter(lambda: f.read(4096), b""): + hash_sha256.update(chunk) + # if is_low_memory: + # printD("Using Memory Optimized SHA256") + # for chunk in iter(lambda: f.read(4096), b""): + # hash_sha256.update(chunk) + # else: + # hash_sha256.update(f.read()) hash_value = hash_sha256.hexdigest()