Upload prompt_selector_auto_1215_testv9.py
Browse files225 unmodified lines2262272282292292302312322 unmodified lines235236237238239240241242112 unmodified lines355356357356358359360361127 unmodified lines48949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052149249349449552252352452552652752852953053153253353453513 unmodified lines549550551552553554555556557558559560561562563564565566567568569570571572520573574575576577578579580581582583584585586118 unmodified lines70570670770864764864965065170971071171271371471571619 unmodified lines73673773873974074174274374474574674767767867968074874975075175275375442 unmodified lines797798799800801802803804805806807808809810811812813814260 unmodified lines107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233126 unmodified lines1360136113621128136313641365136613671368798 unmodified lines21672168216921702171217221732174217521762177193521782179193719381939194021802181218221832184218521862187218821892190219121922193315 unmodified lines250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825791 unmodified line2581258225832584258525862587258830 unmodified lines2619262026212622262326242625264 unmodified lines289028912892289328942895289628972898289999 unmodified lines2999300030013002300330043005225 unmodified lines mac_var.set(0) button.config(state=tk.NORMAL)
global delay_offset global delay_offset,cached_rows time.sleep(delay_offset)
running_flag = False2 unmodified lines
if mac_var.get() and not running_flag: random_function() if len(cached_rows) == 0: mac_var.set(0) time.sleep(random.uniform(5.1, 8.5)) button.config(state=tk.DISABLED) window.event_generate(GENERATE_EVENT, when="tail")112 unmodified lines
def random_function(): global last_deep_search_keywords, cached_rows, last_selected_row_keywords, top_100_keywords, previous_artist, top_100_counts global current_wildcard_character, current_wildcard_artist global current_wildcard_character, current_wildcard_artist, wildcard_used_fixed_prompt global previous_wildcard_artist, previous_wildcard_character, character_keys, copyright_keys current_deep_search_keywords = entry_deep_search.get().strip() auto_hide_keywords = entry_auto_hide.get().split(',') 127 unmodified lines else: formatted_artist_random_keyword = f"์๊ฐ ํค์๋๊ฐ ์์!!"
def custom_split(text): keywords = [] temp_keyword = "" inside_angle_brackets = False
for char in text: if char == '<': inside_angle_brackets = True temp_keyword += char elif char == '>' and inside_angle_brackets: temp_keyword += char keywords.append(temp_keyword.strip()) temp_keyword = "" inside_angle_brackets = False elif inside_angle_brackets: temp_keyword += char elif char == ',': if temp_keyword: keywords.append(temp_keyword.strip()) temp_keyword = "" else: temp_keyword += char
if temp_keyword: keywords.append(temp_keyword.strip())
return keywords
if cached_rows: if toggle_prompt_var.get() and last_selected_row_keywords: random_row_keywords = [keyword.strip() for keyword in text_output.get("1.0", "end-1c").split(',')] random_row_keywords = [keyword.strip() for keyword in text_output.get("1.0", "end-1c").split(',')] #random_row_keywords[-1].strip() #if random_row_keywords[0]=='': random_row_keywords = last_selected_row_keywords random_row_keywords = custom_split(text_output.get("1.0", "end-1c")) processed_elements = set() if wildcard_used_fixed_prompt: for element in wildcard_used_fixed_prompt: split_elements = element.split(',') processed_elements.update([e.strip() for e in split_elements]) wildcard_used_fixed_prompt = list(processed_elements) random_row_keywords = [keyword for keyword in random_row_keywords if keyword not in wildcard_used_fixed_prompt] text_output.delete('1.0', tk.END) else: wildcard_used_fixed_prompt.clear() if (safe_search_var.get()): for i in range(100): random_index = random.randint(0, len(cached_rows) - 1)13 unmodified lines random_row_keywords = [keyword.strip() for keyword in random_row[0].split(',')] last_selected_row_keywords = random_row_keywords.copy()
def get_wildcard(input_str): global wildcard_dict, wildcards_dir print(input_str) if '/' in input_str: folder, filename = input_str.split('/', 1) file_path = os.path.join(wildcards_dir, folder, filename + '.txt') if folder in wildcard_dict and filename + ".txt" in wildcard_dict[folder] and os.path.exists(file_path): with open(file_path, 'r') as file: lines = file.readlines() return random.choice(lines).strip() if lines else ' ' else: file_path = os.path.join(wildcards_dir, input_str + ".txt") if input_str + ".txt" in wildcard_dict['none'] and os.path.exists(file_path): with open(file_path, 'r') as file: lines = file.readlines() return random.choice(lines).strip() if lines else ' ' return ' '
if(entry_fixed_prompt.get()): entry_text_keywords = entry_fixed_prompt.get() if(',' not in entry_text_keywords[-2:]): entry_text_keywords += ',' entry_text_keywords = entry_text_keywords.split(',') entry_text_keywords = custom_split(entry_text_keywords) entry_text_keywords = [kw.strip() for kw in entry_text_keywords if kw.strip()]
for i, keyword in enumerate(entry_text_keywords): if keyword.startswith('<') and keyword.endswith('>'): vbar_check = keyword.strip('<>').strip() # '<', '>' ์ ๊ฑฐ if '|' in vbar_check: choices = vbar_check.split('|') # '|'๋ฅผ ๊ธฐ์ค์ผ๋ก split entry_text_keywords[i] = random.choice(choices) wildcard_used_fixed_prompt.append(entry_text_keywords[i])
temp_first_keywords = [] #print("1 :", temp_first_keywords)
118 unmodified lines temp_first_keywords.append(keyword) random_row_keywords.remove(keyword)
if not (any(keyword.startswith('<') and keyword.endswith('>') for keyword in temp_first_keywords)): t_temp = [] for keyword in temp_first_keywords: t_temp.append(keyword.strip()) t_temp = list(OrderedDict.fromkeys(t_temp)) temp_first_keywords = list(t_temp) t_temp = [] for keyword in temp_first_keywords: t_temp.append(keyword.strip()) t_temp = list(OrderedDict.fromkeys(t_temp)) temp_first_keywords = list(t_temp)
#last_selected_row_keywords =boy_keywords + girl_keywords[:0] + random_row_keywords #print("3 :", temp_first_keywords)19 unmodified lines random_row_keywords.remove(pattern)
if entry_fixed_prompt_after.get(): entry_after_text = custom_split(entry_fixed_prompt_after.get())
for i, keyword in enumerate(entry_after_text): if keyword.startswith('<') and keyword.endswith('>'): vbar_check = keyword.strip('<>').strip() # '<', '>' ์ ๊ฑฐ if '|' in vbar_check: choices = vbar_check.split('|') # '|'๋ฅผ ๊ธฐ์ค์ผ๋ก split entry_after_text[i] = random.choice(choices) wildcard_used_fixed_prompt.append(entry_after_text[i]) entry_after_text = [keyword.strip() for keyword in entry_fixed_prompt_after.get().split(',')] for at_kw in entry_after_text: if at_kw not in random_row_keywords and at_kw not in random_row_keywords: random_row_keywords.append(at_kw)
for at_kw in entry_after_text: if at_kw not in random_row_keywords and at_kw not in random_row_keywords: random_row_keywords.append(at_kw)
rm_copyright = [] if(rm_copyright_var.get()):42 unmodified lines random_row_keywords.remove(keyword) random_row_keywords.insert(found_index,"artist:"+keyword)
for i, keyword in enumerate(random_row_keywords): if keyword.startswith('<') and keyword.endswith('>'): input_str = keyword.strip('<>').strip() # '<', '>' ์ ๊ฑฐ random_row_keywords[i] = get_wildcard(input_str) # get_wildcard ํจ์ ํธ์ถ ๋ฐ ๋์ฒด wildcard_used_fixed_prompt.append(random_row_keywords[i])
random_row_keywords = rearrange_keywords_boys_girls(random_row_keywords)
if '' in random_row_keywords: random_row_keywords.remove('') if ' ' in random_row_keywords: random_row_keywords.remove(' ') #print(random_row_keywords) text_output.insert(tk.END, f"{', '.join(random_row_keywords)}") if auto_copy_var.get():260 unmodified lines search_thread = threading.Thread(target=character_search, daemon=True) search_thread.start()
def copyright_search_thread(): search_thread = threading.Thread(target=copyright_search, daemon=True) search_thread.start()
def copyright_search(): pass def on_search(): # ๊ฒ์ ๋ฒํผ ์ด๋ฒคํธ ์ฒ๋ฆฌ ํจ์ selected_indices = listbox.curselection() if not selected_indices: # If there is no selection print("No selection made.") return # Assuming the first selected index (single selection mode) selected_index = selected_indices[0] # Get the keyword from the listbox, split by '-', and trim whitespace keyword_with_count = listbox.get(selected_index).strip() keyword = keyword_with_count.split('-')[0].strip() # Call the analyze function with the selected keyword print(f"Analyzing keyword: {keyword}") character, cosplay = analyze_keywords_in_data('csdataset.parquet', keyword) #character_prompt.delete('1.0', tk.END) #character_prompt.insert(tk.END, f"{', '.join(character)}") #cosplay_prompt.delete('1.0', tk.END) #cosplay_prompt.insert(tk.END, f"{', '.join(cosplay)}")
def on_key_release(event): # Get the current search keyword search_keyword = search_entry.get() # Update the listbox with matching keywords update_listbox(search_keyword)
def analyze_keywords_in_data(parquet_file, keyword): # Parquet ํ์ผ ์ฝ๊ธฐ df = pd.read_parquet(parquet_file) bag_of_tags = ['penis', 'character name', 'upper body', 'full body', 'artist name', 'male focus', 'open mouth', 'mature male', 'muscular', 'muscular male', 'closed mouth','closed eyes','1girl', '1boy', '1other', 'white background', 'solo', 'breasts', 'simple background', 'smile', 'looking at viewer', 'flat chest', 'small breasts', 'medium breasts', 'large breasts', 'huge breasts','aqua eyes', 'black eyes', 'blue eyes', 'brown eyes', 'green eyes', 'grey eyes', 'orange eyes', 'purple eyes', 'pink eyes', 'red eyes', 'white eyes', 'yellow eyes', 'amber eyes', 'heterochromia', 'multicolored eyes', 'aqua pupils', 'blue pupils', 'brown pupils', 'green pupils', 'grey pupils', 'orange pupils', 'pink pupils', 'purple pupils', 'red pupils', 'white pupils', 'yellow pupils', 'pointy ears', 'long pointy ears', 'aqua hair', 'black hair', 'blonde hair', 'blue hair', 'light blue hair', 'dark blue hair', 'brown hair', 'light brown hair', 'green hair', 'dark green hair', 'light green hair', 'grey hair', 'orange hair', 'pink hair', 'purple hair', 'light purple hair', 'red hair', 'white hair', 'multicolored hair', 'colored inner hair', 'colored tips', 'roots (hair)', 'gradient hair', 'print hair', 'rainbow hair', 'split-color hair', 'spotted hair', 'streaked hair', 'two-tone hair', 'very short hair', 'short hair', 'medium hair', 'long hair', 'very long hair', 'absurdly long hair', 'big hair', 'bald', 'bald girl', 'bob cut', 'inverted bob', 'bowl cut', 'buzz cut', 'chonmage', 'crew cut', 'flattop', 'okappa', 'pixie cut', 'undercut', 'flipped hair', 'wolf cut', 'cornrows', 'dreadlocks', 'hime cut', 'mullet', 'bow-shaped hair', 'braid', 'braided bangs', 'front braid', 'side braid', 'french braid', 'crown braid', 'single braid', 'multiple braids', 'twin braids', 'low twin braids', 'tri braids', 'quad braids', 'flower-shaped hair', 'hair bun', 'braided bun', 'single hair bun', 'double bun', 'cone hair bun', 'doughnut hair bun', 'heart hair bun', 'triple bun', 'cone hair bun', 'hair rings', 'single hair ring', 'half updo', 'one side up', 'two side up', 'low-braided long hair', 'low-tied long hair', 'mizura', 'multi-tied hair', 'nihongami', 'ponytail', 'folded ponytail', 'front ponytail', 'high ponytail', 'short ponytail', 'side ponytail', 'split ponytail', 'star-shaped hair', 'topknot', 'twintails', 'low twintails', 'short twintails', 'uneven twintails', 'tri tails', 'quad tails', 'quin tails', 'twisted hair', 'afro', 'huge afro', 'beehive hairdo', 'crested hair', 'pompadour', 'quiff', 'shouten pegasus mix mori', 'curly hair', 'drill hair', 'twin drills', 'tri drills', 'hair flaps', 'messy hair', 'pointy hair', 'ringlets', 'spiked hair', 'straight hair', 'wavy hair', 'bangs', 'arched bangs', 'asymmetrical bangs', 'bangs pinned back', 'blunt bangs', 'crossed bangs', 'diagonal bangs', 'dyed bangs', 'fanged bangs', 'hair over eyes', 'hair over one eye', 'long bangs', 'parted bangs', 'curtained hair', 'ribbon bangs', 'short bangs', 'swept bangs', 'hair between eyes', 'hair intakes', 'single hair intake', 'sidelocks', 'asymmetrical sidelocks', 'drill sidelocks', 'low-tied sidelocks', 'sidelocks tied back', 'single sidelock', 'ahoge', 'heart ahoge', 'huge ahoge', 'antenna hair', 'heart antenna hair', 'comb over', 'hair pulled back', 'hair slicked back', 'mohawk', 'oseledets', 'lone nape hair', 'hair bikini', 'hair censor', 'hair in own mouth', 'hair over breasts', 'hair over one breast', 'hair over crotch', 'hair over shoulder', 'hair scarf', 'alternate hairstyle', 'hair down', 'hair up', 'asymmetrical hair', 'sidecut', 'blunt ends', 'dark skin', 'dark-skinned female', 'pale skin', 'sun tatoo', 'black skin', 'blue skin', 'green skin', 'grey skin', 'orange skin', 'pink skin', 'purple skin', 'red skin', 'white skin', 'yellow skin', 'colored skin', 'multiple tails', 'demon tail', 'dragon tail', 'ghost tail', 'pikachu tail', 'snake head tail', 'fiery tail', 'bear tail', 'rabbit tail', 'cat tail', 'cow tail', 'deer tail', 'dog tail', 'ermine tail', 'fox tail', 'horse tail', 'leopard tail', 'lion tail', 'monkey tail', 'mouse tail', 'pig tail', 'sheep tail', 'squirrel tail', 'tiger tail', 'wolf tail', 'crocodilian tail', 'fish tail', 'scorpion tail', 'snake tail', 'tadpole tail'] mini_bag_of_tags = ['penis', 'character name', 'upper body', 'full body', 'artist name', 'male focus', 'open mouth', 'mature male', 'muscular', 'muscular male', 'closed mouth','closed eyes','1girl', '1boy', '1other', 'white background', 'solo', 'breasts', 'simple background', 'smile', 'looking at viewer'] # 'character' ์ด์์ keyword์ ํด๋นํ๋ ํ๋ง ํํฐ๋ง filtered_df = df[df['character'] == keyword] filtered_df = filtered_df[~filtered_df['character'].str.contains(',', na=False)] if filtered_df.empty: filtered_df = df[df['character'].str.contains(keyword, na=False, regex=False)] filtered_df = filtered_df[~(filtered_df['rating'] == 'e')] print(len(filtered_df)) # keyword:count ํํ๋ก ๋ฐ์ดํฐ ์ง๊ณํ ๋์
๋๋ฆฌ ์์ฑ keyword_count_dict = {} # ๊ฐ ํ์ 'general' ์ด ์ฒ๋ฆฌ for general in filtered_df['general']: # ๋ฌธ์์ด ๋ถํ tags = [tag.strip() for tag in general.split(',')] # ๋์
๋๋ฆฌ์ ๊ฐ ํ๊ทธ์ count ์ถ๊ฐ for tag in tags: keyword_count_dict[tag] = keyword_count_dict.get(tag, 0) + 1 # ํน์ ํค์๋ ์ ์ธ exclude_keywords = bag_of_tags keyword_count_dict1 = keyword_count_dict.copy() keyword_count_dict1 = {k: v for k, v in keyword_count_dict1.items() if k not in mini_bag_of_tags} keyword_count_dict = {k: v for k, v in keyword_count_dict.items() if k not in exclude_keywords} # ๊ฐ์ฅ ๋์ count ๊ฐ ์ฐพ๊ธฐ highest_count = max(keyword_count_dict.values()) if keyword_count_dict else 0 highest_count1 = max(keyword_count_dict1.values()) if keyword_count_dict1 else 0 if(len(filtered_df)) < 10: weight = 0.6 elif(len(filtered_df)) < 30: weight = 0.5 elif(len(filtered_df)) < 80: weight = 0.45 elif(len(filtered_df)) < 160: weight = 0.35 elif(len(filtered_df)) < 280: weight = 0.3 else: weight = 0.2 result_list = [] result_list1 = [] # count๊ฐ highest_count*0.4 ์ด์์ธ ํค์๋ ์ถ๋ ฅ for k, v in keyword_count_dict.items(): if '|' in k: continue if v >= highest_count * weight: result_list.append(k) for k, v in keyword_count_dict1.items(): if '|' in k: continue if v >= highest_count1 * weight: result_list1.append(k) result_list1.insert(0, keyword) result_list.insert(0, "["+keyword+" (cosplay)]") return result_list1, result_list
def update_listbox(search_keyword): # Clear the listbox listbox.delete(0, tk.END) # Check if the search keyword is not empty if search_keyword: # Find matching keywords in the dictionary # Sort them by count in descending order matching_keywords = sorted( ((k, v) for k, v in cd.character_dictionary.items() if search_keyword.lower() in k.lower()), key=lambda item: item[1], reverse=True ) # Insert the matching keywords into the listbox for keyword, count in matching_keywords: listbox.insert(tk.END, f"{keyword} - {count}") else: # Sort all keywords by count in descending order all_keywords = sorted(cd.character_dictionary.items(), key=lambda item: item[1], reverse=True) for keyword, count in all_keywords: listbox.insert(tk.END, f"{keyword} - {count}")
# ๋ฉ์ธ ์๋์ฐ ์์ฑ ch_search_window = tk.Toplevel(window) ch_search_window.title("์บ๋ฆญํฐ ๊ฒ์") # ํ๋ ์ ์์ฑ (left, center, right) left_frame = tk.Frame(ch_search_window) center_frame = tk.Frame(ch_search_window) right_frame = tk.Frame(ch_search_window) # ํ๋ ์ ๋ฐฐ์น left_frame.grid(row=0, column=0, sticky="nsew") center_frame.grid(row=0, column=1, sticky="ns") right_frame.grid(row=0, column=2, sticky="nsew") # left_frame ๋ด๋ถ ๊ตฌ์ฑ search_label = tk.Label(left_frame, text="๊ฒ์ ํ๋ ค๋ ์บ๋ฆญํฐ:") search_label.grid(row=0, column=0, padx=10, pady=5, sticky="w") copyright_search_button = tk.Button(center_frame, text="์ํ๋ช
๊ฒ์", command=copyright_search_thread) copyright_search_button.grid(row=0, column=0, padx=10, pady=5, sticky="e") search_entry = tk.Entry(left_frame, width=35) search_entry.grid(row=1, column=0, padx=10, pady=5, sticky="ew") search_entry.bind("<KeyRelease>", on_key_release) result_label = tk.Label(left_frame, text="๋งค์นญ ์บ๋ฆญํฐ:") result_label.grid(row=2, column=0, padx=10, pady=5, sticky="ew") listbox = tk.Listbox(left_frame) listbox.grid(row=3, column=0, padx=10, pady=5, sticky="nsew") # center_frame ๋ด๋ถ ๊ตฌ์ฑ search_button = tk.Button(center_frame, text="๊ฒ์", command=on_search) search_button.grid(row=2, column=0, rowspan=4, padx=10, pady=175)
def character_search(): def on_search(): # ๊ฒ์ ๋ฒํผ ์ด๋ฒคํธ ์ฒ๋ฆฌ ํจ์126 unmodified lines # left_frame ๋ด๋ถ ๊ตฌ์ฑ search_label = tk.Label(left_frame, text="๊ฒ์ ํ๋ ค๋ ์บ๋ฆญํฐ:") search_label.grid(row=0, column=0, padx=10, pady=5, sticky="ew") search_label.grid(row=0, column=0, padx=10, pady=5, sticky="w") copyright_search_button = tk.Button(center_frame, text="์ํ๋ช
๊ฒ์", command=copyright_search_thread) copyright_search_button.grid(row=0, column=0, padx=10, pady=5, sticky="e") search_entry = tk.Entry(left_frame, width=35) search_entry.grid(row=1, column=0, padx=10, pady=5, sticky="ew") search_entry.bind("<KeyRelease>", on_key_release) 798 unmodified lines character_text_content = '\n'.join(character_wildcard_saved) character_text.insert('1.0', character_text_content)
# ์ ์ญ ์์ผ๋์นด๋ wildcard_label = tk.Label(wildcard_window, text="๊ธ๋ก๋ฒ ์์ผ๋์นด๋") wildcard_label.grid(row=4, column=0, columnspan=2) wildcard_text = tk.Text(wildcard_window, height=7, width=60) wildcard_text.grid(row=5, column=0, columnspan=2)
# ๋ฒํผ๋ค buttons_frame = tk.Frame(wildcard_window) buttons_frame.grid(row=4, column=0, columnspan=2) buttons_frame.grid(row=6, column=0, columnspan=2)
text_label = tk.Label(wildcard_window, text="wildcard ๋ฌธ๋ฒ(์๊ฐ):\noffset:wildcard1 150:null (helloworld)\noffset:wildcard2 100:none (goodbye)\n์์ผ๋ฉด 100: ์ผ๋ก ๊ฐ์ฃผ\noffset/offset ์ดํฉ: wildcard ํ๋ฅ ") text_label.grid(row=5, column=0,sticky='ew') text_label2 = tk.Label(wildcard_window, text="wildcard ๋ฌธ๋ฒ(์บ๋ฆญ):\n200:{{arona (blue archive)}}, blue hair, blue eyes, hair over one eye, ...\n150:{{nahida (genshin impact)}}, green eyes, pointy ears, ...\n...") text_label2.grid(row=6, column=0,sticky='ew') def reactivate_wildcards(): global wildcard_dict activate_wildcards() pretty_string = "" for key, value in wildcard_dict.items(): pretty_string += f"{key}: {value}\n" wildcard_text.delete('1.0', tk.END) wildcard_text.insert('1.0', pretty_string)
wildcard_button = tk.Button(buttons_frame, text="์ ์ญ ์์ผ๋์นด๋ ๊ฐฑ์ ", command=reactivate_wildcards) wildcard_button.pack(side=tk.LEFT, padx=10)
load_button = tk.Button(buttons_frame, text="์์ผ๋์นด๋ ํ์ฌ", command=lambda: apply_wildcard(artist_text, character_text, wildcard_window)) load_button.pack(side=tk.LEFT, padx=10)315 unmodified lines resized_image = image.resize((new_width, target_height), Image.Resampling.LANCZOS) return resized_image
def open_instant_row(): # ์ ์ฐฝ์ ์์ฑํ๋ ํจ์ def load_to_cache(): # instant_row_text ์์ ฏ์์ ํ
์คํธ๋ฅผ ๊ฐ์ ธ์จ๋ค. text_data = instant_row_text.get("1.0", tk.END) # ํ
์คํธ๊ฐ ๋น์ด์์ง ์๋ค๋ฉด ์ฒ๋ฆฌ if text_data.strip(): # global ํค์๋๋ฅผ ์ฌ์ฉํ์ฌ ํจ์ ๋ฐ์ cached_rows ๋ณ์๋ฅผ ์์ global cached_rows, last_deep_search_keywords,last_generation_seed cached_rows.clear() # cached_rows๋ฅผ ๋น์ด๋ค # ์ค๋ฐ๊ฟ ๋ฌธ์๋ก ํ
์คํธ๋ฅผ ๋ถํ ํ์ฌ ๋ฆฌ์คํธ๋ก ๋ง๋ ๋ค used_list = [] for line in text_data.strip().split('\n'): if line not in used_list: used_list.append(line) temp_line = [line, 0] cached_rows.append(temp_line) print("Cached rows updated!") # ์ฝ์์ ์ํ ๋ฉ์์ง ์ถ๋ ฅ last_deep_search_keywords = cached_rows[0][0][:3] entry_deep_search.delete(0, tk.END) entry_deep_search.insert(tk.END, cached_rows[0][0][:3]) last_generation_seed = random.randint(0,9999999999) hold_seed_var.set(1) mac_var.set(1) random_function() window.event_generate(GENERATE_EVENT, when="tail")
# ์๋ก์ด TopLevel ์๋์ฐ๋ฅผ ์์ฑํ๋ค. new_window = tk.Toplevel() new_window.title("Instant Row")
# Text ์์ ฏ์ ์์ฑํ๋ค. instant_row_text = tk.Text(new_window, width=40, height=10) instant_row_text.pack(padx=10, pady=10)
# 'ํ์ฌ' ๋ฒํผ์ ์์ฑํ๊ณ , load_to_cache ํจ์๋ฅผ command๋ก ์ค์ ํ๋ค. load_button = tk.Button(new_window, text='ํ์ฌ', command=load_to_cache) load_button.pack(padx=10, pady=10)
def activate_wildcards(): global wildcard_dict, wildcards_dir wildcards_dir = os.path.join(os.getcwd(), 'wildcards')
# wildcards ํด๋๊ฐ ์๋์ง ํ์ธํ๊ณ , ์์ผ๋ฉด ์์ฑ if not os.path.exists(wildcards_dir): os.makedirs(wildcards_dir)
# wildcard_dict ๋์
๋๋ฆฌ ์ด๊ธฐํ wildcard_dict = {'none': []}
# wildcards ํด๋ ๋ด์ ํ์ผ ๋ฐ ํด๋๋ช
ํ๋ for item in os.listdir(wildcards_dir): item_path = os.path.join(wildcards_dir, item) # ํ์ผ์ธ ๊ฒฝ์ฐ if os.path.isfile(item_path) and item.endswith('.txt'): wildcard_dict['none'].append(item) # ํด๋์ธ ๊ฒฝ์ฐ elif os.path.isdir(item_path): wildcard_dict[item] = [] # ํด๋น ํด๋ ๋ด์ ํ์ผ๋ค์ ๏ฟฝ๏ฟฝ๏ฟฝ์ for subitem in os.listdir(item_path): subitem_path = os.path.join(item_path, subitem) if os.path.isfile(subitem_path) and subitem.endswith('.txt'): wildcard_dict[item].append(subitem)
auto_time_left_flag = Falseauto_time_left = 0auto_count_left_flag = False1 unmodified linestop_event = Noneauto_thread = Nonedelay_offset = 0wildcard_dict = Nonewildcards_dir = ""
start_time = datetime.now().strftime('%Y%m%d_%H%M')thread_controller = False30 unmodified linestask_finished = 0error_count = 0multi_token_enable = Falsewildcard_used_fixed_prompt = []
whitelist = wlist.whitelistbag_of_tags = tagbag.bag_of_tags264 unmodified linesNSFW_assert_label = tk.Checkbutton(checkbox_frame, text="NSFW Only", variable=NSFW_assert_var)NSFW_assert_label.grid(row=2, column=1, pady=5, sticky='ew')
# Instant rowsinstant_button = tk.Button(checkbox_frame, text="Instant row", command=open_instant_row) #output_file_pathinstant_button.grid(row=2, column=3, sticky='ew')
window.bind('<Control-Return>', on_ctrl_enter)window.bind('<Shift-Return>', on_shift_enter)
99 unmodified lines
Auto_login_check()
activate_wildcards()
window.protocol("WM_DELETE_WINDOW", exit_program)window.mainloop()Danbooru Prompt Selector/TEST2024/prompt_selector_auto_1215_testv9.py+346-22