baqu2213 commited on
Commit
9e9197e
โ€ข
1 Parent(s): 7a4741f

Upload 3 files

Browse files
.gitattributes CHANGED
@@ -133,3 +133,4 @@ Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/NAIA_0218_testv2.exe filte
133
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/NAIA_0220_testv1.exe filter=lfs diff=lfs merge=lfs -text
134
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/NAIA_0222_testv2.exe filter=lfs diff=lfs merge=lfs -text
135
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/NAIA_0222_testv3.exe filter=lfs diff=lfs merge=lfs -text
 
 
133
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/NAIA_0220_testv1.exe filter=lfs diff=lfs merge=lfs -text
134
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/NAIA_0222_testv2.exe filter=lfs diff=lfs merge=lfs -text
135
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/NAIA_0222_testv3.exe filter=lfs diff=lfs merge=lfs -text
136
+ NAIA_0224_testv1.exe filter=lfs diff=lfs merge=lfs -text
NAIA_0224_testv1.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b919b618fae81923e729cf4cb284254c004b474d89e470dccbdbedeb88883e94
3
+ size 888977509
NAIA_0224_testv1.py ADDED
The diff for this file is too large to render. See raw diff
 
NAIA_random_function_core.py CHANGED
@@ -3,10 +3,11 @@ import numpy as np
3
  import re
4
 
5
  def parse_and_execute_commands(processed, user_input, fix, after, popped_row):
6
- commands = [cmd.strip() for cmd in user_input.split(',')]
7
  for command in commands:
8
  condition, cmd = parse_conditional_command(command)
9
- if check_condition(processed, condition, popped_row):
 
10
  processed = execute_command(processed, cmd, fix, after)
11
  return processed
12
 
@@ -93,13 +94,67 @@ def find_keyword_index(general):
93
  # 2์›” 12์ผ์— ํ•ด๋‹น ๋ถ€๋ถ„ return 2 -> return 0 ์œผ๋กœ ์ˆ˜์ •ํ•˜์˜€์œผ๋ฉฐ ์ด ๋ถ€๋ถ„ ํŠธ๋ž˜ํ‚น ํ•„์š”
94
  return 0
95
 
96
- def RFP(popped_row, fix_prompt, after_prompt, auto_hide_prompt, rm_a, rm_s, rm_c, nsfw, data, magic_word):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  boys = ["1boy", "2boys", "3boys", "4boys", "5boys", "6+boys"]
98
  girls = ["1girl", "2girls", "3girls", "4girls", "5girls", "6+girls"]
99
  general = [item.strip() for item in popped_row['general'].split(',')]
100
  special_word_check = fix_prompt+', '+after_prompt
101
  special_word_check = [item.strip() for item in special_word_check.split(',')]
102
  special_word_check = [item for item in special_word_check if item.startswith('*')]
 
103
  exc = []
104
  for keyword in general:
105
  if keyword == '!' or keyword == '!?' or keyword == '!!':
@@ -114,7 +169,24 @@ def RFP(popped_row, fix_prompt, after_prompt, auto_hide_prompt, rm_a, rm_s, rm_c
114
  for keyword in general:
115
  if keyword in data.qe_word or keyword in data.bag_of_tags or "horns" in keyword or "(" in keyword or keyword in boys or keyword in girls:
116
  nsfw_word.append(keyword)
 
 
117
  general = nsfw_word
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  if rm_c == 1:
119
  temp_general = []
120
  for keyword in general:
@@ -122,7 +194,10 @@ def RFP(popped_row, fix_prompt, after_prompt, auto_hide_prompt, rm_a, rm_s, rm_c
122
  temp_general.append(keyword)
123
  for keyword in temp_general:
124
  general.remove(keyword)
125
- fix = [item.strip() for item in fix_prompt.split(',')]
 
 
 
126
  at_first = []
127
  for fp in fix:
128
  if fp.startswith('*'):
@@ -142,8 +217,8 @@ def RFP(popped_row, fix_prompt, after_prompt, auto_hide_prompt, rm_a, rm_s, rm_c
142
  else:
143
  series = []
144
  fix = fix + series
145
- after = [item.strip() for item in after_prompt[:-1].split(',')]
146
- auto_hide = [item.strip() for item in auto_hide_prompt[:-1].split(',')] + ["| |", ":|", "\||/", "<|> <|>", "|| ||", ";|"]
147
  fix_index = find_keyword_index(general)
148
  processed = general.copy()
149
  temp_hide_prompt = []
@@ -203,4 +278,6 @@ def RFP(popped_row, fix_prompt, after_prompt, auto_hide_prompt, rm_a, rm_s, rm_c
203
 
204
  if at_first:
205
  processed = at_first + processed
 
 
206
  return ', '.join(processed), popped_row['rating']
 
3
  import re
4
 
5
  def parse_and_execute_commands(processed, user_input, fix, after, popped_row):
6
+ commands = [cmd.strip() for cmd in user_input.split(',') if not cmd.strip().startswith('#')]
7
  for command in commands:
8
  condition, cmd = parse_conditional_command(command)
9
+ nfix = [item.translate(str.maketrans('', '', '{}[]')) for item in fix if not item.startswith('#')]
10
+ if check_condition(processed+nfix, condition, popped_row):
11
  processed = execute_command(processed, cmd, fix, after)
12
  return processed
13
 
 
94
  # 2์›” 12์ผ์— ํ•ด๋‹น ๋ถ€๋ถ„ return 2 -> return 0 ์œผ๋กœ ์ˆ˜์ •ํ•˜์˜€์œผ๋ฉฐ ์ด ๋ถ€๋ถ„ ํŠธ๋ž˜ํ‚น ํ•„์š”
95
  return 0
96
 
97
+ def process_list(temp_fixed):
98
+ i = 0
99
+ while i < len(temp_fixed):
100
+ if ', ' in temp_fixed[i]:
101
+ # ํ•ด๋‹น ์›์†Œ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ํ•จ์ˆ˜์— ์ „๋‹ฌํ•˜๊ณ  ๊ฒฐ๊ณผ๋ฅผ ๋ฐ›์Œ
102
+ processed_items = process_fix_prompt(temp_fixed[i])
103
+ # ์›๋ž˜ ์›์†Œ๋ฅผ ์ œ๊ฑฐ
104
+ temp_fixed.pop(i)
105
+ # ์ฒ˜๋ฆฌ๋œ ์›์†Œ๋“ค์„ ํ˜„์žฌ ์ธ๋ฑ์Šค์— ์‚ฝ์ž…
106
+ for item in reversed(processed_items):
107
+ temp_fixed.insert(i, item)
108
+ # ์‚ฝ์ž…๋œ ์›์†Œ๋“ค์„ ๊ฑด๋„ˆ๋›ฐ๊ธฐ ์œ„ํ•ด ์ธ๋ฑ์Šค ์กฐ์ •
109
+ i += len(processed_items)
110
+ else:
111
+ i += 1
112
+ return temp_fixed
113
+
114
+ def process_fix_prompt(fix_prompt):
115
+ fix = []
116
+ lt_count = 0 # '<' ๋ฌธ์ž ๊ฐœ์ˆ˜ ์ถ”์ 
117
+ current_item = "" # ํ˜„์žฌ ํ•ญ๋ชฉ์„ ๊ฒฐํ•ฉํ•˜๊ธฐ ์œ„ํ•œ ๋ณ€์ˆ˜
118
+
119
+ # fix_prompt๋ฅผ ์‰ผํ‘œ๋กœ ๋ถ„๋ฆฌํ•˜๊ณ  ๊ฐ ํ•ญ๋ชฉ์„ ์ˆœํšŒ
120
+ for item in fix_prompt.split(','):
121
+ item = item.strip() # ๊ณต๋ฐฑ ์ œ๊ฑฐ
122
+
123
+ if '<' in item:
124
+ lt_count += item.count('<') # '<' ๋ฐœ๊ฒฌ ์‹œ ์นด์šดํŠธ ์ฆ๊ฐ€
125
+ lt_count -= item.count('>')
126
+ if current_item: # ์ด๋ฏธ current_item์— ๊ฐ’์ด ์žˆ๋Š” ๊ฒฝ์šฐ ์‰ผํ‘œ์™€ ๊ณต๋ฐฑ ์ถ”๊ฐ€
127
+ current_item += ", "
128
+ if lt_count <= 0: # lt_count๊ฐ€ 0์ด๋ฉด ์ผ๋ฐ˜ ํ•ญ๋ชฉ์œผ๋กœ ์ฒ˜๋ฆฌ
129
+ fix.append(item)
130
+ else:
131
+ current_item += item # ํ˜„์žฌ ํ•ญ๋ชฉ์— ์ถ”๊ฐ€
132
+ elif '>' in item:
133
+ lt_count -= item.count('>') # '>' ๋ฐœ๊ฒฌ ์‹œ ์นด์šดํŠธ ๊ฐ์†Œ
134
+ current_item += ", " + item # '>'๊ฐ€ ์žˆ๋Š” ํ•ญ๋ชฉ๋„ ํ˜„์žฌ ํ•ญ๋ชฉ์— ์ถ”๊ฐ€
135
+ if lt_count == 0: # '<'์™€ '>'์˜ ๊ฐœ์ˆ˜๊ฐ€ ๋งค์นญ๋˜๋ฉด fix์— ์ถ”๊ฐ€ํ•˜๊ณ  current_item ์ดˆ๊ธฐํ™”
136
+ fix.append(current_item)
137
+ current_item = ""
138
+ else:
139
+ if lt_count <= 0: # lt_count๊ฐ€ 0์ด๋ฉด ์ผ๋ฐ˜ ํ•ญ๋ชฉ์œผ๋กœ ์ฒ˜๋ฆฌ
140
+ fix.append(item)
141
+ else: # lt_count๊ฐ€ 0์ด ์•„๋‹ˆ๋ฉด ํ˜„์žฌ ํ•ญ๋ชฉ์— ๊ณ„์†ํ•ด์„œ ์ถ”๊ฐ€
142
+ current_item += ", " + item
143
+
144
+ # ๋งˆ์ง€๋ง‰์— ๋‚จ์€ current_item ์ฒ˜๋ฆฌ
145
+ if current_item:
146
+ fix.append(current_item)
147
+
148
+ return fix
149
+
150
+ def RFP(popped_row, fix_prompt, after_prompt, auto_hide_prompt, rm_a, rm_s, rm_c, rm_loc, rm_color, nsfw, data, magic_word):
151
  boys = ["1boy", "2boys", "3boys", "4boys", "5boys", "6+boys"]
152
  girls = ["1girl", "2girls", "3girls", "4girls", "5girls", "6+girls"]
153
  general = [item.strip() for item in popped_row['general'].split(',')]
154
  special_word_check = fix_prompt+', '+after_prompt
155
  special_word_check = [item.strip() for item in special_word_check.split(',')]
156
  special_word_check = [item for item in special_word_check if item.startswith('*')]
157
+ colors = ['black','white','blond','silver','gray','yellow','blue','purple','red','pink','brown','orange','green','aqua','gradient']
158
  exc = []
159
  for keyword in general:
160
  if keyword == '!' or keyword == '!?' or keyword == '!!':
 
169
  for keyword in general:
170
  if keyword in data.qe_word or keyword in data.bag_of_tags or "horns" in keyword or "(" in keyword or keyword in boys or keyword in girls:
171
  nsfw_word.append(keyword)
172
+ nsfw_word = list(set(nsfw_word))
173
+ nsfw_word.sort()
174
  general = nsfw_word
175
+ if rm_loc == 1:
176
+ temp_general = []
177
+ locations = ['airplane interior', 'airport', 'apartment', 'arena', 'armory', 'bar', 'barn', 'bathroom', 'bathtub', 'bedroom', 'bell tower', 'billiard room', 'book store', 'bowling alley', 'bunker', 'bus interior', 'butcher shop', 'cafe', 'cafeteria', 'car interior', 'casino', 'castle', 'catacomb', 'changing room', 'church', 'classroom', 'closet', 'construction site', 'convenience store', 'convention hall', 'court', 'dining room', 'drugstore', 'ferris wheel', 'flower shop', 'gym', 'hangar', 'hospital', 'hotel room', 'hotel', 'infirmary', 'izakaya', 'kitchen', 'laboratory', 'library', 'living room', 'locker room', 'mall', 'messy room', 'mosque', 'movie theater', 'museum', 'nightclub', 'office', 'onsen', 'ovservatory', 'phone booth', 'planetarium', 'pool', 'prison', 'refinery', 'restaurant', 'restroom', 'rural', 'salon', 'school', 'sex shop', 'shop', 'shower room', 'skating rink', 'snowboard shop', 'spacecraft interior', 'staff room', 'stage', 'supermarket', 'throne', 'train station', 'tunnel', 'airfield', 'alley', 'amphitheater', 'aqueduct', 'bamboo forest', 'beach', 'blizzard', 'bridge', 'bus stop', 'canal', 'canyon', 'carousel', 'cave', 'cliff', 'cockpit', 'conservatory', 'cross walk', 'desert', 'dust storm', 'flower field', 'forest', 'garden', 'gas staion', 'gazebo', 'geyser', 'glacier', 'graveyard', 'harbor', 'highway', 'hill', 'island', 'jungle', 'lake', 'market', 'meadow', 'nuclear powerplant', 'oasis', 'ocean bottom', 'ocean', 'pagoda', 'parking lot', 'playground', 'pond', 'poolside', 'railroad', 'rainforest', 'rice paddy', 'roller coster', 'rooftop', 'rope bridge', 'running track', 'savannah', 'shipyard', 'shirine', 'skyscraper', 'soccor field', 'space elevator', 'stair', 'starry sky', 'swamp', 'tidal flat', 'volcano', 'waterfall', 'waterpark', 'wheat field', 'zoo', 'white background', 'simple background', 'grey background', 'gradient background', 'blue background', 'black background', 'yellow background', 'pink background', 'red background', 'brown background', 'green background', 'purple background', 'orange background']
178
+ for keyword in general:
179
+ if keyword in locations:
180
+ temp_general.append(keyword)
181
+ for keyword in temp_general:
182
+ general.remove(keyword)
183
+ if rm_color == 1:
184
+ temp_general = []
185
+ for keyword in general:
186
+ if any(color in keyword for color in colors):
187
+ temp_general.append(keyword)
188
+ for keyword in temp_general:
189
+ general.remove(keyword)
190
  if rm_c == 1:
191
  temp_general = []
192
  for keyword in general:
 
194
  temp_general.append(keyword)
195
  for keyword in temp_general:
196
  general.remove(keyword)
197
+
198
+ #NAIA_random_function_core.process_fix_prompt()
199
+ fix = process_fix_prompt(fix_prompt)
200
+
201
  at_first = []
202
  for fp in fix:
203
  if fp.startswith('*'):
 
217
  else:
218
  series = []
219
  fix = fix + series
220
+ after = [item.strip() for item in after_prompt.split(',')]
221
+ auto_hide = [item.strip() for item in auto_hide_prompt.split(',') if not item.strip().startswith('#')] + ["| |", ":|", "\||/", "<|> <|>", "|| ||", ";|"]
222
  fix_index = find_keyword_index(general)
223
  processed = general.copy()
224
  temp_hide_prompt = []
 
278
 
279
  if at_first:
280
  processed = at_first + processed
281
+ for i, key in enumerate(processed):
282
+ if key.startswith('#'): processed[i] = '\n\n'+key+'\n'
283
  return ', '.join(processed), popped_row['rating']