baqu2213 commited on
Commit
f63920a
โ€ข
1 Parent(s): 0c57f0a

Upload 3 files

Browse files
.gitattributes CHANGED
@@ -118,3 +118,4 @@ Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/WEBUIA_0119.exe filter=lfs
118
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/WEBUIA_0124.exe filter=lfs diff=lfs merge=lfs -text
119
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/NAIA_0201_testv1.exe filter=lfs diff=lfs merge=lfs -text
120
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/NAIA_0203_testv2.exe filter=lfs diff=lfs merge=lfs -text
 
 
118
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/WEBUIA_0124.exe filter=lfs diff=lfs merge=lfs -text
119
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/NAIA_0201_testv1.exe filter=lfs diff=lfs merge=lfs -text
120
  Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/NAIA_0203_testv2.exe filter=lfs diff=lfs merge=lfs -text
121
+ Danbooru[[:space:]]Prompt[[:space:]]Selector/TEST2024/WEBUIA_0211.exe filter=lfs diff=lfs merge=lfs -text
Danbooru Prompt Selector/TEST2024/NAIA_random_function_core (WEBUIA_0211).py ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas
2
+ import numpy as np
3
+
4
+ def find_keyword_index(general):
5
+ # boys์™€ girls ๋ฆฌ์ŠคํŠธ์˜ ์›์†Œ๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธ ๋ฐ ์ธ๋ฑ์Šค ์ €์žฅ
6
+ boys = ["1boy", "2boys", "3boys", "4boys", "5boys", "6+boys"]
7
+ girls = ["1girl", "2girls", "3girls", "4girls", "5girls", "6+girls"]
8
+ #others = ["1other", "2others", "3others", "4others", "5others", "6+others"]
9
+ boys_indices = [i for i, item in enumerate(general[:6]) if item in boys]
10
+ girls_indices = [i for i, item in enumerate(general[:6]) if item in girls]
11
+
12
+ # case 1๊ณผ case 2: girls ๋ฆฌ์ŠคํŠธ์˜ ์›์†Œ ์ฐพ๊ธฐ
13
+ if girls_indices:
14
+ return girls_indices[0]+1
15
+
16
+ # case 3: boys ๋ฆฌ์ŠคํŠธ์˜ ์›์†Œ ์ฐพ๊ธฐ
17
+ if boys_indices:
18
+ return boys_indices[0]+1
19
+
20
+ # case 4: ํ•ด๋‹น ์‚ฌํ•ญ ์—†์Œ
21
+ return 2
22
+
23
+ def RFP(popped_row, fix_prompt, after_prompt, auto_hide_prompt, rm_a, rm_s, rm_c, nsfw, data, magic_word):
24
+ boys = ["1boy", "2boys", "3boys", "4boys", "5boys", "6+boys"]
25
+ girls = ["1girl", "2girls", "3girls", "4girls", "5girls", "6+girls"]
26
+ general = [item.strip() for item in popped_row['general'].split(',')]
27
+ if nsfw == 1:
28
+ nsfw_word = []
29
+ for keyword in general:
30
+ 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:
31
+ nsfw_word.append(keyword)
32
+ general = nsfw_word
33
+ if rm_c == 1:
34
+ temp_general = []
35
+ for keyword in general:
36
+ if keyword in data.bag_of_tags:
37
+ temp_general.append(keyword)
38
+ for keyword in temp_general:
39
+ general.remove(keyword)
40
+ fix = [item.strip() for item in fix_prompt[:-1].split(',')]
41
+ at_first = []
42
+ for fp in fix:
43
+ if fp.startswith('*'):
44
+ at_first.append(fp[1:])
45
+ if at_first:
46
+ for af in at_first:
47
+ if '*'+af in fix:
48
+ fix.remove('*'+af)
49
+ if rm_a == 0:
50
+ if popped_row['artist']:
51
+ artists = [item.strip() for item in popped_row['artist'].split(',')]
52
+ #for i, keyword in enumerate(artists):
53
+ # if '(' in keyword and ')' in keyword:
54
+ # artists[i] = keyword.replace('(', '\\(').replace(')', '\\)')
55
+ artist = ["artist:" + _artist for _artist in artists]
56
+ fix = fix + artist
57
+ if rm_s == 0:
58
+ if popped_row['copyright']:
59
+ series = [item.strip() for item in popped_row['copyright'].split(',')]
60
+ #for i, keyword in enumerate(series):
61
+ # if '(' in keyword and ')' in keyword:
62
+ # series[i] = keyword.replace('(', '\\(').replace(')', '\\)')
63
+ else:
64
+ series = []
65
+ fix = fix + series
66
+ after = [item.strip() for item in after_prompt[:-1].split(',')]
67
+ auto_hide = [item.strip() for item in auto_hide_prompt[:-1].split(',')] + ["| |", ":|", "\||/", "<|> <|>", "|| ||", ";|"]
68
+ fix_index = find_keyword_index(general)
69
+ processed = general.copy()
70
+ temp_hide_prompt = []
71
+ processed[fix_index:fix_index] = fix
72
+ processed += after
73
+ for keyword in processed:
74
+ if keyword in auto_hide:
75
+ temp_hide_prompt.append(keyword)
76
+ for keyword in temp_hide_prompt:
77
+ processed.remove(keyword)
78
+
79
+ if rm_c == 0:
80
+ if popped_row['character']:
81
+ character = [item.strip() for item in popped_row['character'].split(',')]
82
+ #for i, keyword in enumerate(character):
83
+ # if '(' in keyword and ')' in keyword:
84
+ # character[i] = keyword.replace('(', '\\(').replace(')', '\\)')
85
+ processed[fix_index:fix_index] = character
86
+ fix_index+=len(character)
87
+ if magic_word["random_artist"] == True:
88
+ processed.insert(fix_index, magic_word["random_artist_name"])
89
+
90
+ boy_in_processed = girl_in_processed = None
91
+ for boy in boys:
92
+ if boy in processed:
93
+ boy_in_processed = boy
94
+ break
95
+
96
+ for girl in girls:
97
+ if girl in processed:
98
+ girl_in_processed = girl
99
+ break
100
+
101
+ if boy_in_processed and girl_in_processed:
102
+ boy_index = processed.index(boy_in_processed)
103
+ girl_index = processed.index(girl_in_processed)
104
+ if boy_index > girl_index:
105
+ processed.pop(boy_index)
106
+ processed.insert(girl_index, boy_in_processed)
107
+ if(popped_row['rating'] == 'e'):
108
+ rating_text = ', rating: explicit, nsfw'
109
+ elif(popped_row['rating'] == 'q'):
110
+ rating_text = ', rating: questionable, nsfw'
111
+ elif(popped_row['rating'] == 's'):
112
+ rating_text = ', rating: sensitive'
113
+ else:
114
+ rating_text = ', rating: general'
115
+
116
+ if at_first:
117
+ processed = at_first + processed
118
+ return ', '.join(processed)+rating_text
Danbooru Prompt Selector/TEST2024/WEBUIA_0211.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:934e862dfac3c748a8baecc068269578151770ec14d68f8ceeac03b331bdbb2f
3
+ size 837840755
Danbooru Prompt Selector/TEST2024/WEBUIA_0211.py ADDED
The diff for this file is too large to render. See raw diff