baqu2213 commited on
Commit
6914732
·
1 Parent(s): b9c3093

Upload 2 files

Browse files
Danbooru Prompt Selector/TEST2024/prompt_selector_auto_1215_testv9.exe CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2de13ef437ae80bdf617829959f017d41cf55d8162935beac38a43ed370442c6
3
- size 151554073
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e4344bbce3f0943697fa5183c62d64ed48fb751cbe0261fcfa574e8f394a510
3
+ size 151554180
Danbooru Prompt Selector/TEST2024/prompt_selector_auto_1215_testv9.py CHANGED
@@ -629,14 +629,14 @@ def random_function():
629
  if folder in wildcard_dict and filename + ".txt" in wildcard_dict[folder] and os.path.exists(file_path):
630
  with open(file_path, 'r') as file:
631
  lines = file.readlines()
632
- return random.choice(lines).strip() if lines else ' '
633
  else:
634
  file_path = os.path.join(wildcards_dir, input_str + ".txt")
635
  if input_str + ".txt" in wildcard_dict['none'] and os.path.exists(file_path):
636
  with open(file_path, 'r') as file:
637
  lines = file.readlines()
638
- return random.choice(lines).strip() if lines else ' '
639
- return ' '
640
 
641
  if(entry_fixed_prompt.get()):
642
  entry_text_keywords = entry_fixed_prompt.get()
@@ -871,7 +871,15 @@ def random_function():
871
  for i, keyword in enumerate(random_row_keywords):
872
  if keyword.startswith('<') and keyword.endswith('>'):
873
  input_str = keyword.strip('<>').strip() # '<', '>' 제거
874
- random_row_keywords[i] = get_wildcard(input_str) # get_wildcard 함수 호출 및 대체
 
 
 
 
 
 
 
 
875
  wildcard_used_fixed_prompt.append(random_row_keywords[i])
876
 
877
  random_row_keywords = rearrange_keywords_boys_girls(random_row_keywords)
 
629
  if folder in wildcard_dict and filename + ".txt" in wildcard_dict[folder] and os.path.exists(file_path):
630
  with open(file_path, 'r') as file:
631
  lines = file.readlines()
632
+ return random.choice(lines).strip() if lines else input_str
633
  else:
634
  file_path = os.path.join(wildcards_dir, input_str + ".txt")
635
  if input_str + ".txt" in wildcard_dict['none'] and os.path.exists(file_path):
636
  with open(file_path, 'r') as file:
637
  lines = file.readlines()
638
+ return random.choice(lines).strip() if lines else input_str
639
+ return input_str
640
 
641
  if(entry_fixed_prompt.get()):
642
  entry_text_keywords = entry_fixed_prompt.get()
 
871
  for i, keyword in enumerate(random_row_keywords):
872
  if keyword.startswith('<') and keyword.endswith('>'):
873
  input_str = keyword.strip('<>').strip() # '<', '>' 제거
874
+ if("__" in input_str):
875
+ adjectives = re.findall(r'__(.*?)__', input_str)
876
+ last_keyword = re.split(r'__.*?__', input_str)[-1]
877
+ adjective_string = ""
878
+ for adjective in adjectives:
879
+ adjective_string += (get_wildcard(adjective) + " ")
880
+ random_row_keywords[i] = adjective_string + get_wildcard(last_keyword)
881
+ else:
882
+ random_row_keywords[i] = get_wildcard(input_str)
883
  wildcard_used_fixed_prompt.append(random_row_keywords[i])
884
 
885
  random_row_keywords = rearrange_keywords_boys_girls(random_row_keywords)