Hi, i am using Civitai Web Helper since its launch but after 1.5 the extension is a bit abandoned and i am slowly transitioning to the base model info of Automatic1111 that can add activation words automatically to the prompt when you click on a Lora.
So i made an easy script that reads all the "civitai.info" files in the Lora folder and creates a json file for them that contains: activation text, SD base model and a prompt in the Notes.
Note: if a json already exists, the script just skips that. If the civitai file contains error or is empty, the script just skips that.
All you have to do is change the folder inside the script: input_folder = r"C:\Programs\stable-diffusion-webui\models\lora" to your lora folder and run the script. You can do it by double clicking it if you have py files connected to python or you can just open your cmd and type: python ConvertCivitaiInfoToJSON.py if you have the script in the folder you are on with CMD. After this you can start clicking on a Lora and the activation text is automatically added to the prompt.
You can run the script everytime you download a new file from civitai, just continue using civitai WebHelper to download the info, and run the script to convert the informations.
I could integrate this with civitai-WebHelper to make it more powerful but as of right now i don't have time to improve my python coding skills to do that, feel free to do it if you want ;)
Have Fun!
Description
FAQ
Comments (8)
Love this idea, always bugged me that downloading files via Civitai never downloaded the info files, despite 3rd party apps do. This could be a game changer, look forward to trying it.
sounds great, do you think it would be possible for you to implement a button to call this script into the civitai helper tab? next to the big scan button perhaps?
Should be very easy, but the script's code needs to be cleaned up a bit first, namely moving the global section at the bottom to a main function (which is called when \_\_name\_\_ == \_\_main\_\_ , standard procedure).
In scripts/civitai_helper.py, the following lines need to be added (haven't tested):
# Add this around the import section.
from ConvertCivitaiInfoToJson import main_function
# Add this to on_ui_tabs after this first line.
scan_model_civitai_btn = gr.Button(value="Scan", variant="primary", elem_id="ch_scan_model_civitai_btn")
json_info_btn = gr.Button(value = "Scan json")
# Add this to the events section.
scan_model_civitai_btn.click(model_action_civitai.scan_model, inputs=[scan_model_types_ckbg, max_size_preview_ckb, skip_nsfw_preview_ckb], outputs=scan_model_log_md)
json_info_btn.click(main_function, inputs = [], outputs = [])
And obviously the script file should be placed alongside civitai_helper.py.
@firemanbrakeneck i would still have to manually edit the script file to point it to my lora folder, am i correct? that's not automized by these changes, right?
@eurotaku Sorry, didn't notice that hardcoded parameter at first glance. It should probably be replaced with calls over lora_dir and lyco_dir, possibly embeddings if relevant (a function again comes in handy):
from modules import shared
lyco_dir = shared.cmd_opts.lyco_dir
lora_dir = shared.cmd_opts.lora_dir
# main_function calls loop(lyco_dir) + loop(lora_dir).
@firemanbrakeneck err, would it be too much asking you to provide a civitai helper modification including your script? for the next version perhaps? would be really awesome ;)
@eurotaku My script? I'm not the author, just threw some advice as I'm wont to do. It would be problematic to modify civ helper directly since the author seems to have abandoned the project back in may, but perhaps an open PR.
@firemanbrakeneck oh, sorry, my bad :D

