Greetings, I’m working on my first t2i generator, and I’m in need of a little assistance.

I want to output 4 images with 4 different attributes for one of the prompt terms. Let’s say shirt color. I understand that I could easily create 4 different outputs, but that would mean duplicating the whole prompt 4 times. I’d rather have it be more concise using one output and dynamically change on reload (with no duplicates).

A consumable list seems like what I would need, but it seems like this still requires 2 outputs?

This works, and outputs my 4 colors correctly with no dupes:

output1
  [c = shirtcolor.consumableList]
output2
  [c]

HTML:

[output1]
[output2]
[output2]
[output2]

I’d prefer it if I could get this to work with just one output. Thanks for any help or tips!

  • perchance@lemmy.worldM
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    I’m not 100% sure if this answers your question, but:

    Lists:

    output
      [c = shirtcolor.consumableList, ""][prompt.selectMany(4).joinItems(", ")]
    
    prompt
      a person wearing a [c] shirt
    

    HTML:

    [output]
    

    And you can write [prompt], [prompt], [prompt], [prompt] instead of [prompt.selectMany(4).joinItems(", ")] if you want.

    If you desperately want to squash it all into a single output list, you can do this:

    output
      [c = shirtcolor.consumableList, ""]["a person wearing a [c] shirt".selectMany(4).joinItems(", ")]
    

    But that’s probably not a great idea. Hopefully that helps! Let me know if not.

    • Ashenthorn@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      @perchance@lemmy.world Thanks for the reply! Much appreciated. 👍

      Hmm… maybe I didn’t explain properly. I tried your code and got weird results. Your output/prompt is concatenating the color list… which I don’t want.

      I’m basically trying to output 4 images with DIFFERENT prompts using ONE output. Here is my (almost) working generator: https://perchance.org/zh7u0fwp8q

      As you can see, when randomizing, EACH of the outputs correctly outputs a distinct ethnicity and a distinct shirt color - with no duplicates.

      It’s almost perfect, but it’s still using 2 prompts/outputs (because the consumable list seems to require it) which I think will be a problem if/when I set up a user input for the prompt.

      I’m basically just trying to insert a single list item into the prompt… but don’t want duplicates in the output which is why I thought consumable list was the way to do it. Is there some way to get/store the list items BEFORE inserting them into the prompt?

      • VioneT@lemmy.worldM
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 year ago

        Try this snippet:

        output
          [e = ethnicity.consumableList, c = shirtColor.consumableList, ''] [new Array(4).fill(0).map(a => `<div>${t2i(prompt)}<br>${lastTextToImagePrompt}</div>`).joinItems("")]
        
        prompt
          prompt = [bodyType] [e] Woman wearing a [c] shirt
          resolution = 512x768
          guidanceScale = 5
        

        First we instantiate the consumable lists. Then, we create an Array with the size of the length of the consumable list (to prevent no more items), we then fill it with default items first, then map the items by changing them to host the t2i outputs then join them.

        • Ashenthorn@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          Wow! That looks perfect… This will also allow me to easily add use user inputs, and add the prompt parameters all in one place.

          Thanks so much for the help!

          I’ll be sure to post again if I run into any trouble. 🙂

        • Ashenthorn@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          This is even better. And much cleaner. Absolutely perfect.

          Initiating the list is definitely the way to go over outputting an array.

          Thanks ever SO much!!

          😲 🤓