adieyal / sd-dynamic-prompts

A custom script for AUTOMATIC1111/stable-diffusion-webui to implement a tiny template language for random prompt generation
MIT License
2.04k stars 262 forks source link

wildcard in JSON format #619

Open CharlesCato opened 1 year ago

CharlesCato commented 1 year ago

I don't know if I do something wrong, but I can't have a wildcard working as soon as it is in json format. I tried with the exemple given in the doc (and corrected the ' after Van Goth into ") but when I refresh wildcards, nothing appears in the list. No clothing, nor artists, nor anything with the filename (called it main.json). I wanted to try json to test if the if/else/then was working with wildcards.

{
    "clothing": [
        "T-shirt",
        "Pants",
        "Shoes"
    ],
    "artists": {
        "finnish": [
            "Akseli Gallen-Kallela",
            "Eero Järnefelt",
            "Helene Schjerfbeck"
        ],
        "dutch": [
            "Piet Mondrian",
                "Rembrandt van Rijn",
                "Vincent van Gogh"
        ]
    }
}

Thank you for your time !

akx commented 1 year ago

Do you see the entries appear in the Wildcards Manager tab?

CharlesCato commented 1 year ago

Do you see the entries appear in the Wildcards Manager tab?

when I refresh wildcards, nothing appears in the list. No clothing, nor artists, nor anything with the filename (called it main.json).

CharlesCato commented 1 year ago

I also checked the file on an online json-validator without issues. I also made yaml file without any problems. But there is no if/then in yaml. So i really wanted to try json.

BTW: I'm using vlado repo since I'm on Radeon. Maybe there is something in his repo that prevent dynamic prompts working with json files. Who knows. I've searched in the discussions and it seems nobody ever tried json format or speak about it anyway. Are we even sure it's working or....

akx commented 1 year ago

when I refresh wildcards, nothing appears in the list. No clothing, nor artists, nor anything with the filename (called it main.json).

Then I'd say the file is not found.

I've searched in the discussions and it seems nobody ever tried json format or speak about it anyway. Are we even sure it's working or....

I copied the JSON from your post, pasted it into a file,

$ pbpaste > extensions/sd-dynamic-prompts/wildcards/issue619.json

and the wildcards are correctly populated: Screenshot 2023-09-15 at 12 25 45 Screenshot 2023-09-15 at 12 25 40

CharlesCato commented 1 year ago

That's very strange. Don't know why it's not opening json files on my config then. :( Even tried to remove every other files to let only the json, and nothing. I mean.... it can't be notepad++ f***** up the format ? I'll try more after lunch.

CharlesCato commented 1 year ago

Well... I give up json. Not working with my config. There is no point trying more. Not sure what to do with the issue though. Still unresolved, but since I don't know anybody who could try with vlado repo+amd, I'm stucked.

akx commented 1 year ago

Just to make sure, you are putting the JSON in the extension's wildcard directory? Are there any errors in the console?

CharlesCato commented 1 year ago

Yeah... same place as my other wilcards files. No errors concerning DynaPrompts. Some for dynamic thresholding and script/hook.py. But nothing I can fix manually. These errors come and go as upgrades come. I could try to updrage again. But it never worked anyway. Even with 0 errors.

Autantpourmoi commented 1 year ago

same thing to me , can't see any .json file in that directory. Did some research on the net to check if there was a special way of using this .json file but didn't find anything , only .txt files are recognized

CharlesCato commented 11 months ago

1st thought: @Autantpourmoi What repo are you using ? 2nd thought: @akx Can't be a country localization, right ? (just a thought thrown in the air. cause I'm pretty sure he is also french).

ema7569 commented 11 months ago

Hi, same problem with yaml files. Refreshing do nothing. Renaming the file from .json or .yaml to .txt and the file show normally in the manager.

CharlesCato commented 11 months ago

.json or .yaml to .txt Well they all uses different syntaxes though. If your yaml isn't valid, it won't show.