baqu2213 commited on
Commit
27c28e5
·
verified ·
1 Parent(s): b0d4913

Fix issue causing Opus Limit

Browse files
Danbooru Prompt Selector/TEST2024/NAIA_0203_testv2.exe CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1d40589e77bf675d2bf7d3091ad0262dbb3ff3fc281be4fd5c2ffd13fcba56d5
3
- size 838002830
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b181fe1650c180086599fec283bdd9444e22f2adb356b391d075318eaaae1f4
3
+ size 838003288
Danbooru Prompt Selector/TEST2024/NAIA_0203_testv2.py CHANGED
@@ -1727,6 +1727,59 @@ class App(customtkinter.CTk):
1727
  nsfw_word += basket
1728
  words = []
1729
  if len(nsfw_word) > 13:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1730
  max_val = len(nsfw_word) // 3
1731
  if len(nsfw_word) % 3 > 0: max_val += 1
1732
  for i in range(max_val):
@@ -1768,7 +1821,7 @@ class App(customtkinter.CTk):
1768
  if random_seed:
1769
  gen_request_sub["seed" ] = random.randint(0,9999999999)
1770
  request_list.append(copy.deepcopy(gen_request_sub))
1771
- elif len(nsfw_word) > 5:
1772
  max_val = len(nsfw_word) // 2 + len(nsfw_word) % 2
1773
  for i in range(max_val):
1774
  current_word = []
@@ -1830,6 +1883,12 @@ class App(customtkinter.CTk):
1830
  request_list.append(treq_3)
1831
  except:
1832
  request_list.append(gen_request)
 
 
 
 
 
 
1833
 
1834
  def run_generation():
1835
  if gen_request["png_rule"] == "count":
@@ -1859,7 +1918,12 @@ class App(customtkinter.CTk):
1859
  if self.error_count >= 10:
1860
  self.automation_button.deselect()
1861
  temp = result_prompt
1862
- time.sleep(1)
 
 
 
 
 
1863
  if self.automation_button.get() == 0 or retry_count >= 5:
1864
  break
1865
  self.running_flag = False
@@ -1885,7 +1949,7 @@ class App(customtkinter.CTk):
1885
  set_image_to_queue(result_image, result_prompt, result_seed, filename)
1886
  #자동화 체크
1887
  if self.automation_button.get() == 1:
1888
- instant_wait = random.uniform(4.5, 8.5) + self.delay_offset
1889
  if instant_wait < 0 : instant_wait = 0.5
1890
  if self.image_generation_repeat_flag == False or (self.image_generation_repeat <= self.image_generation_repeat_current):
1891
  self.image_generation_repeat_current = 0
@@ -1935,7 +1999,12 @@ class App(customtkinter.CTk):
1935
  self.automation_button.deselect()
1936
  self.turbo_button.deselect()
1937
  temp = result_prompt
1938
- time.sleep(1)
 
 
 
 
 
1939
  if self.turbo_button.get() == 0 or retry_count >= 5:
1940
  break
1941
  self.running_flag = False
 
1727
  nsfw_word += basket
1728
  words = []
1729
  if len(nsfw_word) > 13:
1730
+ max_val = len(nsfw_word) // 4
1731
+ if len(nsfw_word) % 4 > 0: max_val += 1
1732
+ for i in range(max_val):
1733
+ current_word = []
1734
+ if i < max_val - 1:
1735
+ words.append(nsfw_word[i*4])
1736
+ words.append(nsfw_word[i*4+1])
1737
+ words.append(nsfw_word[i*4+2])
1738
+ words.append(nsfw_word[i*4+3])
1739
+ current_word.append(nsfw_word[i*4])
1740
+ current_word.append(nsfw_word[i*4+1])
1741
+ current_word.append(nsfw_word[i*4+2])
1742
+ current_word.append(nsfw_word[i*4+3])
1743
+ else:
1744
+ if len(nsfw_word) % 4 == 0:
1745
+ words.append(nsfw_word[i*4])
1746
+ words.append(nsfw_word[i*4+1])
1747
+ words.append(nsfw_word[i*4+2])
1748
+ words.append(nsfw_word[i*4+3])
1749
+ current_word.append(nsfw_word[i*4])
1750
+ current_word.append(nsfw_word[i*4+1])
1751
+ current_word.append(nsfw_word[i*4+2])
1752
+ current_word.append(nsfw_word[i*4+3])
1753
+ elif len(nsfw_word) % 4 == 3:
1754
+ words.append(nsfw_word[i*4])
1755
+ words.append(nsfw_word[i*4+1])
1756
+ words.append(nsfw_word[i*4+2])
1757
+ current_word.append(nsfw_word[i*4])
1758
+ current_word.append(nsfw_word[i*4+1])
1759
+ current_word.append(nsfw_word[i*4+2])
1760
+ elif len(nsfw_word) % 4 == 2:
1761
+ words.append(nsfw_word[i*4])
1762
+ words.append(nsfw_word[i*4+1])
1763
+ current_word.append(nsfw_word[i*4])
1764
+ current_word.append(nsfw_word[i*4+1])
1765
+ else:
1766
+ words.append(nsfw_word[i*4])
1767
+ current_word.append(nsfw_word[i*4])
1768
+ gen_request_sub = copy.deepcopy(gen_request)
1769
+ temp_prompt = []+pre_prompt
1770
+ for keyword in nsfw_word:
1771
+ if keyword not in words:
1772
+ if random_seed == False:
1773
+ temp_prompt[temp_prompt.index(keyword)] = " "*len(keyword)
1774
+ else:
1775
+ temp_prompt.remove(keyword)
1776
+ elif keyword in current_word:
1777
+ temp_prompt[temp_prompt.index(keyword)] = "{"+keyword+"}"
1778
+ gen_request_sub["prompt"] = ', '.join(temp_prompt)
1779
+ if random_seed:
1780
+ gen_request_sub["seed" ] = random.randint(0,9999999999)
1781
+ request_list.append(copy.deepcopy(gen_request_sub))
1782
+ elif len(nsfw_word) > 8:
1783
  max_val = len(nsfw_word) // 3
1784
  if len(nsfw_word) % 3 > 0: max_val += 1
1785
  for i in range(max_val):
 
1821
  if random_seed:
1822
  gen_request_sub["seed" ] = random.randint(0,9999999999)
1823
  request_list.append(copy.deepcopy(gen_request_sub))
1824
+ elif len(nsfw_word) > 3:
1825
  max_val = len(nsfw_word) // 2 + len(nsfw_word) % 2
1826
  for i in range(max_val):
1827
  current_word = []
 
1883
  request_list.append(treq_3)
1884
  except:
1885
  request_list.append(gen_request)
1886
+ else:
1887
+ pre_prompt = gen_request["prompt"]
1888
+ pre_prompt = [keyword.strip() for keyword in pre_prompt.split(',')]
1889
+ if "*(split nsfw)-rand" in pre_prompt:
1890
+ pre_prompt.remove("*(split nsfw)-rand")
1891
+ gen_request["prompt"] = ', '.join(pre_prompt)
1892
 
1893
  def run_generation():
1894
  if gen_request["png_rule"] == "count":
 
1918
  if self.error_count >= 10:
1919
  self.automation_button.deselect()
1920
  temp = result_prompt
1921
+ if self.automation_button.get() == 1:
1922
+ instant_wait = random.uniform(3.5, 5.5) + self.delay_offset
1923
+ if instant_wait < 0 : instant_wait = 0.5
1924
+ time.sleep(instant_wait)
1925
+ else:
1926
+ time.sleep(1)
1927
  if self.automation_button.get() == 0 or retry_count >= 5:
1928
  break
1929
  self.running_flag = False
 
1949
  set_image_to_queue(result_image, result_prompt, result_seed, filename)
1950
  #자동화 체크
1951
  if self.automation_button.get() == 1:
1952
+ instant_wait = random.uniform(3.5, 5.5) + self.delay_offset
1953
  if instant_wait < 0 : instant_wait = 0.5
1954
  if self.image_generation_repeat_flag == False or (self.image_generation_repeat <= self.image_generation_repeat_current):
1955
  self.image_generation_repeat_current = 0
 
1999
  self.automation_button.deselect()
2000
  self.turbo_button.deselect()
2001
  temp = result_prompt
2002
+ if self.automation_button.get() == 1:
2003
+ instant_wait = random.uniform(4.5, 8.5) + self.delay_offset
2004
+ if instant_wait < 0 : instant_wait = 0.5
2005
+ time.sleep(instant_wait)
2006
+ else:
2007
+ time.sleep(1)
2008
  if self.turbo_button.get() == 0 or retry_count >= 5:
2009
  break
2010
  self.running_flag = False