I tried to use markvo chain with below database to generate photography ideas.

k-mktr/improved-flux-prompts-photoreal-portrait · Datasets at Hugging Face

API:

async function fetchData(x) {
    try {
      const response = await fetch('<https://datasets-server.huggingface.co/rows?dataset=k-mktr%2Fimproved-flux-prompts-photoreal-portrait&config=default&split=train&offset=0&length=100>');
      const data = await response.json();
      lines = data;  // Assign data to a global variable
  
      if (x) x();  // Call the callback function if it exists
    } catch (error) {
      console.error('Error fetching data:', error);
    }
  }

I used Dan’s demo Markov code, But I integrated it with my discord bot.

I extracted all the prompts for generating AI images from the database in an array and used that array for the Markvo chain to generate new prompts

First, I used the default ngram (1) and max number (280) from the demo

I can feel the sense from the generated prompts, but it’s a bit too long and doesn’t make too much sense.

image.png

So I changed the ngram to 4 and the max to 50

The sentences look so much better, but still a little bit too long

And I also wander what will happen if the ngram is large!

image.png

So I changed the ngram to 8 and max to 20

It seems nicer, but the sentence seems to never end, I have to choose a smaller ngram

image.png

I changed the ngram to 3 and max to 15, but still, the sentence won’t end

image.png

So this is the problem and question, how can I finish a sentence!?!?