Upload 3 files
Browse filesFiles changed (3)
123version https://git-lfs.github.com/spec/v1oid sha256:b7ba6f64444dccfdd0f7b2b0f4ab932b162672a7c3af96c52c66cc8b6974ed6csize 854809517123version https://git-lfs.github.com/spec/v1oid sha256:ed930dce820246f3fd23b659146b785be2e0bbe144570958141036414f4d63fesize 854809782
714 unmodified lines71571671771871972072172272372472572646 unmodified lines773774775776777778779780781782783784785786767 unmodified lines155415551556155715581559156037 unmodified lines159815991600160116021603160416051606894 unmodified lines250125022503250425052506250725082509251025112512431 unmodified lines2944294529462947294829492950295129522953295429552956295769 unmodified lines302730283029303030313032303330343035303630373038303930403041218 unmodified lines3260326132623263326432653266326721 unmodified lines32893290329132923293329432953296329732983299330033013302330333043305330633073308203 unmodified lines35123513351435153516351735187 unmodified lines35263527352835293530353135323533353435353536686 unmodified lines4223422442254226422742284229423053 unmodified lines428442854286428742884289429043 unmodified lines4334433543364337433843394340230 unmodified lines457145724573457445754576457745784579458045814582103 unmodified lines4686468746884689469046914692289 unmodified lines4982498349844985498649874988498949904991499219 unmodified lines5012501350145015501650175018501950205021502250235024502550265027502843 unmodified lines507250735074507550765077507850795080508150825083103 unmodified lines51875188518951905191519226 unmodified lines521952205221522252235224522571 unmodified lines5297529852995300530153025303530453055306530790 unmodified lines539853995400540154025403540499 unmodified lines55045505550655075508550922 unmodified lines5532553355345535553655375538425 unmodified lines596459655966596759685969143 unmodified lines6113611461156116611761186119355 unmodified lines64756476647764786479648064816482648364846485486 unmodified lines697269736974697569766977697869796980698169826983312 unmodified lines729672977298729973007301730273037304730573067307714 unmodified linesuncond_pre = 1.0app.uncond_strength_entry.delete(0, "end")app.uncond_strength_entry.insert(0, "1.0")gen_request = {"width":896,"height":1152,"quality_toggle":app.auto_quality_toggle.get(),"seed":random.randint(0,9999999999),"sampler":app.sampler_button.get(),"scale":scale_pre,"sema":app.sema_button.get(),"sema_dyn": app.dyn_button.get(),46 unmodified linesinstant_result_image = customtkinter.CTkImage(result_image, size=(620,620))else:current_image = Image.open(filename)original_width, original_height = current_image.sizemax_size = app.winfo_screenheight()-100if original_width > max_size or original_height > max_size:new_image = Image.new("RGB", (max_size, max_size), "black")new_image.paste(current_image, ((max_size - original_width) // 2, (max_size - original_height) // 2))instant_result_image = customtkinter.CTkImage(new_image, size=(max_size, max_size))else:instant_result_image = customtkinter.CTkImage(current_image, size=(max_size, max_size))app.image_label.configure(image=instant_result_image)app.ext_set_image_to_queue(result_image, result_prompt, str(result_seed), filename)if continuous_generation.get() == 1:767 unmodified linesself.xy_plot_count = 0self.import_image_negative = {}self.title("NAIA Beta v1.09.2 (Test version 3)")self.grid_rowconfigure(0, weight=1)#self.columnconfigure(2, weight=1)37 unmodified linesself.text_input_label.configure(text=" ------------------------ 프롬프트 ------------------------ ", text_color="#F2FBFF")if self.sync_i2i_img:if self.sync_i2i_contents:_img2img(self,self.sync_i2i_img.copy(), self.sync_i2i_contents.copy())else:_img2img(self,self.sync_i2i_img.copy())self.sync_i2i_img = Noneself.sync_i2i_contents = Noneself.after(500, sync_text)894 unmodified linesafter_wildcard = self.image_generation_repeat_promptself.image_generation_repeat_current += 1##############################gen_request = {"width":NAI_width,"height":NAI_height,"quality_toggle":self.auto_quality_toggle.get(),"seed":self.seed_entry.get(),"sampler":self.sampler_button.get(),"scale":scale_pre,"uncond_scale":uncond_pre,"sema":self.sema_button.get(),431 unmodified linesinstant_result_image = customtkinter.CTkImage(result_image, size=(620,620))else:current_image = Image.open(filename)original_width, original_height = current_image.sizemax_size = app.winfo_screenheight()-100if original_width > max_size or original_height > max_size:new_image = Image.new("RGB", (max_size, max_size), "black")new_image.paste(current_image, ((max_size - original_width) // 2, (max_size - original_height) // 2))instant_result_image = customtkinter.CTkImage(new_image, size=(max_size, max_size))else:instant_result_image = customtkinter.CTkImage(current_image, size=(max_size, max_size))self.image_label.configure(image=instant_result_image)set_image_to_queue(result_image, result_prompt, result_seed, filename)#자동화 체크69 unmodified linesinstant_result_image = customtkinter.CTkImage(result_image, size=(620,620))else:current_image = Image.open(filename)original_width, original_height = current_image.sizemax_size = app.winfo_screenheight()-100if original_width > max_size or original_height > max_size:new_image = Image.new("RGB", (max_size, max_size), "black")new_image.paste(current_image, ((max_size - original_width) // 2, (max_size - original_height) // 2))instant_result_image = customtkinter.CTkImage(new_image, size=(max_size, max_size))else:instant_result_image = customtkinter.CTkImage(current_image, size=(max_size, max_size))self.image_label.configure(image=instant_result_image)set_image_to_queue(result_image, result_prompt, str(result_seed), filename)instant_wait = random.uniform(4.5, 8.5) + self.delay_offsetif instant_wait < 0 : instant_wait = 0.5218 unmodified linesself.rm_location_button = customtkinter.CTkCheckBox(self.rm_extend_frame, text="장소/배경색 제거", variable=self.rm_location_var, font=my_font)self.image_reference_frame = customtkinter.CTkFrame(self.rm_extend_frame)self.image_reference_canvas = customtkinter.CTkCanvas(self.image_reference_frame, width=486 if self.winfo_screenheight() < 1152 else 600, bg="#333333", highlightthickness = 1, highlightbackground = 'grey10')self.image_reference_canvas.grid(row=0, column=0, columnspan=3, padx=5, pady=5, sticky="n")def slider_event_IRS(value):self.image_reference_strength_label.configure(text=f"Reference Strength : {value:.2f}")21 unmodified linesself.image_reference_canvas.delete(self.image_id)self.image_id = Noneself.image_reference_strength_label = customtkinter.CTkLabel(self.image_reference_canvas, font=v_large_font, text_color='white', text=f"Reference Strength : 0.6", fg_color='transparent', width=190)self.information_extracted_label = customtkinter.CTkLabel(self.image_reference_canvas, font=v_large_font, text_color='white', text=f"Information Extracted : 1", fg_color='transparent', width=190)self.image_reference_strength = customtkinter.CTkSlider(self.image_reference_canvas, from_=0.01, to=1.00, number_of_steps=100, command=slider_event_IRS, button_color='grey', button_hover_color='grey10', height=20, width=120 if self.winfo_screenheight() < 1152 else 180, progress_color='transparent')self.information_extracted = customtkinter.CTkSlider(self.image_reference_canvas, from_=0.01, to=1.00, number_of_steps=100, command=slider_event_IE, button_color='grey', button_hover_color='grey10', height=20, width=120 if self.winfo_screenheight() < 1152 else 180, progress_color='transparent')self.exit_reference_mode = customtkinter.CTkButton(self.image_reference_canvas, text="Vibe Transfer 해제", font=my_font, command=rem_image_reference, fg_color='grey10', hover_color='grey', corner_radius=0)if self.winfo_screenheight() >= 1152:irc_xpos = [150, 150, 440, 440, 300]else:irc_xpos = [130, 130, 390, 390, 260]self.image_reference_canvas.create_window(irc_xpos[0], 140, window=self.image_reference_strength_label)self.image_reference_canvas.create_window(irc_xpos[1], 90, window=self.information_extracted_label)self.image_reference_canvas.create_window(irc_xpos[2], 140, window=self.image_reference_strength)self.image_reference_canvas.create_window(irc_xpos[3], 90, window=self.information_extracted)self.image_reference_canvas.create_window(irc_xpos[4], 190, window=self.exit_reference_mode)def yield_rm_character_name():if self.rm_character_name_var.get() == 1:203 unmodified lines#이미지 히스토리self.image_history_frame = customtkinter.CTkFrame(self.right_frame)self.image_history_frame.grid(row=0, column=0, columnspan=2, rowspan=15, padx=5, pady=5, sticky="n")def show_context_menu(event):if len(app.image_queue) != 0:7 unmodified linesself.image_reference_canvas.delete(self.image_id)self.image_id = Nonereference_string = NAIA_generation.image_to_base64(img)self.image_reference = copy.deepcopy(img)self.image_reference_string = reference_stringenhancer = ImageEnhance.Brightness(self.image_reference)darker_image = enhancer.enhance(0.5)self.image_reference_tk = ImageTk.PhotoImage(darker_image.resize((486, 468) if self.winfo_screenheight() < 1152 else (600, 468), Image.Resampling.LANCZOS))self.image_id = self.image_reference_canvas.create_image(0, 0, image=self.image_reference_tk, anchor='nw')self.image_reference_strength.set(0.6)self.information_extracted.set(1)686 unmodified linesself.resolution_button.grid(row=2, column=1, padx=5, sticky="w")self.sampler_label = customtkinter.CTkLabel(self.extended_right_frame, text="Sampler :", font=my_font)self.sampler_label.grid(row=2, column=2,pady=5, padx=15, sticky="w")self.sampler_var = customtkinter.StringVar(value="k_euler_ancestral")self.sampler_button = customtkinter.CTkComboBox(self.extended_right_frame, width=210,values=["k_euler", "k_euler_ancestral", "k_dpmpp_2s_ancestral", "k_dpmpp_sde", "k_dpmpp_2m"], variable=self.sampler_var, font=my_font)self.sampler_button.grid(row=2, column=2, columnspan=2, pady=5, padx=15, sticky="e")self.show_fullscreen_btn = customtkinter.CTkButton(self.extended_right_frame, text="전체화면(ESC닫기)", font=my_font, command=self.show_fullscreen_image)self.show_fullscreen_btn.grid(row=2, column=4,pady=5, padx=5, sticky="nsew")53 unmodified linesif current_size != app.last_window_size:app.last_window_size = current_sizeif app.state() == 'zoomed':self.hidden_frame.configure(width=round(360 / (app.dpi /100), 0))if app.dpi >= 100 and app.dpi < 125 : offset = 10elif app.dpi >= 125 and app.dpi < 150 : offset = 5elif app.dpi >= 150: offset = 043 unmodified linesself.resolution_button2.grid(row=3, column=1, padx=5, sticky="w")self.sampler_label2 = customtkinter.CTkLabel(self.hidden_frame, text="Sampler :", font=my_font)self.sampler_label2.grid(row=4, column=0,pady=5, padx=5, sticky="w")self.sampler_button2 = customtkinter.CTkComboBox(self.hidden_frame, width=160,values=["k_euler", "k_euler_ancestral", "k_dpmpp_2s_ancestral", "k_dpmpp_sde", "k_dpmpp_2m"], variable=self.sampler_var, font=my_font)self.sampler_button2.grid(row=4, column=1, columnspan=2, pady=5, padx=5, sticky="e")self.cfg_scale_label2 = customtkinter.CTkLabel(self.hidden_frame, text="CFG Scale : ", font=my_font)self.cfg_scale_label2.grid(row=5, column=0,pady=5, padx=5, sticky="w")230 unmodified linesexcept:i2i_negative_text = self.negative_prompt_input.get("0.0", "end-1c")inpaint_check = sum(sum(row) for row in mirror_image) >= 50gen_request = {"width":self.i2i_width if not inpaint_check else cwidth ,"height":self.i2i_height if not inpaint_check else cheight,"quality_toggle":self.auto_quality_toggle.get(),"seed":request_seed if self.i2i_seed_hold_check == True else random.randint(0,9999999999),"sampler":self.sampler_button.get(),"scale":scale_pre,"uncond_scale":uncond_pre,"sema":self.sema_button.get(),103 unmodified linesiimg = Noneinpaint_mode = Falseiimg = Image.open(filename).convert("RGB")original_image = iimg.copy()cwidth, cheight = iimg.sizecurrent_dpi = app.dpi289 unmodified linesdef i2i_set_image_reference():filepath = filedialog.askopenfilename(title="Open Image", filetypes=[("Image files", "*.png;*.jpg;*.webp"), ("All files", "*.*")])if filepath:i2irf["image_reference"] = Image.open(filepath)i2irf["image_reference_string"] = NAIA_generation.image_to_base64(i2irf["image_reference"])enhancer = ImageEnhance.Brightness(i2irf["image_reference"])darker_image = enhancer.enhance(0.5)i2irf["image_reference_tk"] = ImageTk.PhotoImage(darker_image.resize((486, 468) if self.winfo_screenheight() < 1152 else (600, 468), Image.Resampling.LANCZOS))i2irf["image_id"] = image_reference_canvas.create_image(0, 0, image=i2irf["image_reference_tk"], anchor='nw')image_reference_strength.set(0.6)information_extracted.set(1)19 unmodified linesi2irf["image_id"] = Noneimage_reference_frame = customtkinter.CTkFrame(i2i_generate_frame)image_reference_canvas = customtkinter.CTkCanvas(image_reference_frame, width=600, height=200,bg="#333333", highlightthickness = 1, highlightbackground = 'grey10')image_reference_canvas.grid(row=0, column=0, columnspan=4, padx=5, pady=5, sticky="n")image_reference_strength_label = customtkinter.CTkLabel(image_reference_canvas, font=v_large_font, text_color='white', text=f"Reference Strength : 0.6", fg_color='transparent', width=190)information_extracted_label = customtkinter.CTkLabel(image_reference_canvas, font=v_large_font, text_color='white', text=f"Information Extracted : 1", fg_color='transparent', width=190)image_reference_strength = customtkinter.CTkSlider(image_reference_canvas, from_=0.01, to=1.00, number_of_steps=100, command=slider_event_IRS, button_color='grey', button_hover_color='grey10', height=20, progress_color='transparent')information_extracted = customtkinter.CTkSlider(image_reference_canvas, from_=0.01, to=1.00, number_of_steps=100, command=slider_event_IE, button_color='grey', button_hover_color='grey10', height=20, progress_color='transparent')exit_reference_mode = customtkinter.CTkButton(image_reference_canvas, text="Vibe Transfer 해제", font=my_font, command=lambda: i2i_rem_image_reference(i2irf), fg_color='grey10', hover_color='grey', corner_radius=0)if self.winfo_screenheight() >= 1152:irc_xpos = [130, 130, 420, 420, 280]else:irc_xpos = [110, 110, 370, 370, 240]image_reference_canvas.create_window(irc_xpos[0], 120, window=image_reference_strength_label)image_reference_canvas.create_window(irc_xpos[1], 70, window=information_extracted_label)image_reference_canvas.create_window(irc_xpos[2], 120, window=image_reference_strength)43 unmodified linesself.uncond_strength_entry.delete(0, "end")self.uncond_strength_entry.insert(0, "1.0")i2i_negative_text = self.negative_prompt_input.get("0.0", "end-1c")gen_request = {"width":self.i2i_width,"height":self.i2i_height,"quality_toggle":self.auto_quality_toggle.get(),"seed":request_seed if self.i2i_seed_hold_check == True else random.randint(0,9999999999),"sampler":self.sampler_button.get(),"scale":scale_pre,"uncond_scale":uncond_pre,"sema":self.sema_button.get(),103 unmodified linesself.after(1000, update_rating)self.after(2000, self.get_winfo_fpixels)self.initialize_ui(self.select_rating_frame, my_font, update_labels, perform_search, depth_search)def get_winfo_fpixels(self):ps_script = '''26 unmodified lines'''# PowerShell 명령어 실행result = subprocess.run(['powershell', '-Command', ps_script], capture_output=True, text=True)self.dpi = int(result.stdout.strip())def initialize_ui(self, frame, my_font, update_labels, perform_search, depth_search):self.search_button = customtkinter.CTkButton(71 unmodified linesself.image_reference_canvas.delete(self.image_id)self.image_id = Nonereference_string = NAIA_generation.image_to_base64(img)self.image_reference = copy.deepcopy(img)self.image_reference_string = reference_stringenhancer = ImageEnhance.Brightness(self.image_reference)darker_image = enhancer.enhance(0.5)self.image_reference_tk = ImageTk.PhotoImage(darker_image.resize((486, 468) if self.winfo_screenheight() < 1152 else (600, 468), Image.Resampling.LANCZOS))self.image_id = self.image_reference_canvas.create_image(0, 0, image=self.image_reference_tk, anchor='nw')self.image_reference_strength.set(0.6)self.information_extracted.set(1)90 unmodified lineswidth, height = img.sizenew_size = max(width, height)new_image = Image.new("RGB", (new_size, new_size), 'black')left = (new_size - width) // 2top = (new_size - height) // 2new_image.paste(img, (left, top))99 unmodified lines# 이미지 객체로부터 키워드 추출description = extract_keywords_from_image(img)if description == '' or description == None:returnelif type(description) == type(' '):22 unmodified lineswidth, height = img.sizenew_size = max(width, height)new_image = Image.new("RGB", (new_size, new_size), 'black')left = (new_size - width) // 2top = (new_size - height) // 2new_image.paste(img, (left, top))425 unmodified linesself.prompt_guidance_rescale_var.set(settings["guidance"])except: passtry:self.sampler_var.set(settings["sampler"])self.sampler_button.set(settings["sampler"])except: pass143 unmodified linesresized_image = image.resize((new_width, new_height), Image.Resampling.LANCZOS)# 새 이미지 (배경) 생성new_image = Image.new("RGB", (max_width, max_height), "black")# 리사이즈된 이미지를 새 이미지의 중앙에 배치paste_x = (max_width - new_width) // 2355 unmodified linesapp.image_reference_canvas.delete(app.image_id)app.image_id = Nonereference_string = NAIA_generation.image_to_base64(img)app.image_reference = copy.deepcopy(img)app.image_reference_string = reference_stringenhancer = ImageEnhance.Brightness(app.image_reference)darker_image = enhancer.enhance(0.5)app.image_reference_tk = ImageTk.PhotoImage(darker_image.resize((486, 468) if app.winfo_screenheight() < 1152 else (600, 468), Image.Resampling.LANCZOS))app.image_id = app.image_reference_canvas.create_image(0, 0, image=app.image_reference_tk, anchor='nw')app.image_reference_strength.set(_irs)app.image_reference_strength_label.configure(text=f"Reference Strength : {_irs:.2f}")486 unmodified linesuncond_pre = 1.0self.uncond_strength_entry.delete(0, "end")self.uncond_strength_entry.insert(0, "1.0")_gen_request = {"width":NAI_width,"height":NAI_height,"quality_toggle":self.auto_quality_toggle.get(),"seed":self.seed_entry.get(),"sampler":self.sampler_button.get(),"scale":scale_pre,"uncond_scale":uncond_pre,"sema":self.sema_button.get(),312 unmodified lines_random_seed = random.randint(0,9999999999)for _ni, insf in enumerate(contents):if _val and _val != _ni: continue_gen_request = {"width":NAI_width,"height":NAI_height,"quality_toggle":self.auto_quality_toggle.get(),"seed": _random_seed,"sampler":self.sampler_button.get(),"scale":scale_pre,"uncond_scale":uncond_pre,"sema":self.sema_button.get(),714 unmodified lines71571671771871972072172272372472572672772846 unmodified lines775776777778779780781782783767 unmodified lines155115521553155415551556155737 unmodified lines159515961597159815991600160116021603894 unmodified lines24982499250025012502250325042505250625072508250925102511431 unmodified lines2943294429452946294729482949295069 unmodified lines302030213022302330243025302630273028218 unmodified lines32473248324932503251325221 unmodified lines327432753276327732783279328032813282328332843285328632873288328932903291329232933294203 unmodified lines34983499350035013502350335047 unmodified lines35123513351435153516351735183519352035213522686 unmodified lines4209421042114212421342144215421653 unmodified lines427042714272427342744275427643 unmodified lines4320432143224323432443254326230 unmodified lines45574558455945604561456245634564456545664567456845694570103 unmodified lines4674467546764677467846794680289 unmodified lines4970497149724973497449754976497749784979498019 unmodified lines5000500150025003500450055006500750085009501050115012501343 unmodified lines50575058505950605061506250635064506550665067506850695070103 unmodified lines517451755176517751785179518026 unmodified lines520752085209521052115212521371 unmodified lines5285528652875288528952905291529252935294529590 unmodified lines538653875388538953905391539299 unmodified lines549254935494549554965497549822 unmodified lines5521552255235524552555265527425 unmodified lines5953595459555956595759585959143 unmodified lines6103610461056106610761086109355 unmodified lines64656466646764686469647064716472647364746475486 unmodified lines69626963696469656966696769686969697069716972697369746975312 unmodified lines72887289729072917292729372947295729672977298729973007301714 unmodified linesuncond_pre = 1.0app.uncond_strength_entry.delete(0, "end")app.uncond_strength_entry.insert(0, "1.0")_sampler, _noise_schedule = app.sampler_button.get().split(' + ')gen_request = {"width":896,"height":1152,"quality_toggle":app.auto_quality_toggle.get(),"seed":random.randint(0,9999999999),"sampler":_sampler,"noise_schedule": _noise_schedule,"scale":scale_pre,"sema":app.sema_button.get(),"sema_dyn": app.dyn_button.get(),46 unmodified linesinstant_result_image = customtkinter.CTkImage(result_image, size=(620,620))else:current_image = Image.open(filename)current_image = Image.open(filename)new_image = app.resize_and_center_image(current_image, app.wide_res_width, app.wide_res_height)instant_result_image = customtkinter.CTkImage(new_image, size=(app.wide_res_width, app.wide_res_height))app.image_label.configure(image=instant_result_image)app.ext_set_image_to_queue(result_image, result_prompt, str(result_seed), filename)if continuous_generation.get() == 1:767 unmodified linesself.xy_plot_count = 0self.import_image_negative = {}self.title("NAIA Beta v1.09.3 (Test version 4)")self.grid_rowconfigure(0, weight=1)#self.columnconfigure(2, weight=1)37 unmodified linesself.text_input_label.configure(text=" ------------------------ 프롬프트 ------------------------ ", text_color="#F2FBFF")if self.sync_i2i_img:if self.sync_i2i_contents:_img2img(self,self.sync_i2i_img, self.sync_i2i_contents.copy())else:_img2img(self,self.sync_i2i_img)self.sync_i2i_img = Noneself.sync_i2i_contents = Noneself.after(500, sync_text)894 unmodified linesafter_wildcard = self.image_generation_repeat_promptself.image_generation_repeat_current += 1##############################_sampler, _noise_schedule = app.sampler_button.get().split(' + ')gen_request = {"width":NAI_width,"height":NAI_height,"quality_toggle":self.auto_quality_toggle.get(),"seed":self.seed_entry.get(),"sampler":_sampler,"noise_schedule": _noise_schedule,"scale":scale_pre,"uncond_scale":uncond_pre,"sema":self.sema_button.get(),431 unmodified linesinstant_result_image = customtkinter.CTkImage(result_image, size=(620,620))else:current_image = Image.open(filename)new_image = self.resize_and_center_image(current_image, self.wide_res_width, self.wide_res_height)instant_result_image = customtkinter.CTkImage(new_image, size=(self.wide_res_width, self.wide_res_height))self.image_label.configure(image=instant_result_image)set_image_to_queue(result_image, result_prompt, result_seed, filename)#자동화 체크69 unmodified linesinstant_result_image = customtkinter.CTkImage(result_image, size=(620,620))else:current_image = Image.open(filename)new_image = self.resize_and_center_image(current_image, self.wide_res_width, self.wide_res_height)instant_result_image = customtkinter.CTkImage(new_image, size=(self.wide_res_width, self.wide_res_height))self.image_label.configure(image=instant_result_image)set_image_to_queue(result_image, result_prompt, str(result_seed), filename)instant_wait = random.uniform(4.5, 8.5) + self.delay_offsetif instant_wait < 0 : instant_wait = 0.5218 unmodified linesself.rm_location_button = customtkinter.CTkCheckBox(self.rm_extend_frame, text="장소/배경색 제거", variable=self.rm_location_var, font=my_font)self.image_reference_frame = customtkinter.CTkFrame(self.rm_extend_frame)def slider_event_IRS(value):self.image_reference_strength_label.configure(text=f"Reference Strength : {value:.2f}")21 unmodified linesself.image_reference_canvas.delete(self.image_id)self.image_id = Nonedef initialize_reference():self.image_reference_canvas = customtkinter.CTkCanvas(self.image_reference_frame, width=int(486* (self.dpi / 100)), bg="#333333", highlightthickness = 1, highlightbackground = 'grey10')self.image_reference_canvas.grid(row=0, column=0, columnspan=3, padx=5, pady=5, sticky="n")self.image_reference_strength_label = customtkinter.CTkLabel(self.image_reference_canvas, font=v_large_font, text_color='white', text=f"Reference Strength : 0.6", fg_color='transparent', width=190)self.information_extracted_label = customtkinter.CTkLabel(self.image_reference_canvas, font=v_large_font, text_color='white', text=f"Information Extracted : 1", fg_color='transparent', width=190)self.image_reference_strength = customtkinter.CTkSlider(self.image_reference_canvas, from_=0.01, to=1.00, number_of_steps=100, command=slider_event_IRS, button_color='grey', button_hover_color='grey10', height=20, width=180, progress_color='transparent')self.information_extracted = customtkinter.CTkSlider(self.image_reference_canvas, from_=0.01, to=1.00, number_of_steps=100, command=slider_event_IE, button_color='grey', button_hover_color='grey10', height=20, width=180, progress_color='transparent')self.exit_reference_mode = customtkinter.CTkButton(self.image_reference_canvas, text="Vibe Transfer 해제", font=my_font, command=rem_image_reference, fg_color='grey10', hover_color='grey', corner_radius=0)irc_xpos = [int(130* (self.dpi / 100)), int(130* (self.dpi / 100)), int(320* (self.dpi / 100)), int(320* (self.dpi / 100)), int(260* (self.dpi / 100))]self.image_reference_canvas.create_window(irc_xpos[0], 140, window=self.image_reference_strength_label)self.image_reference_canvas.create_window(irc_xpos[1], 90, window=self.information_extracted_label)self.image_reference_canvas.create_window(irc_xpos[2], 140, window=self.image_reference_strength)self.image_reference_canvas.create_window(irc_xpos[3], 90, window=self.information_extracted)self.image_reference_canvas.create_window(irc_xpos[4], 190, window=self.exit_reference_mode)def yield_rm_character_name():if self.rm_character_name_var.get() == 1:203 unmodified lines#이미지 히스토리self.image_history_frame = customtkinter.CTkFrame(self.right_frame)self.image_history_frame.grid(row=0, column=0, columnspan=2, rowspan=15, padx=5, pady=5, sticky="w")def show_context_menu(event):if len(app.image_queue) != 0:7 unmodified linesself.image_reference_canvas.delete(self.image_id)self.image_id = Nonereference_string = NAIA_generation.image_to_base64(img)self.image_reference = copy.deepcopy(img.convert('RGBA'))self.image_reference_string = reference_stringenhancer = ImageEnhance.Brightness(self.image_reference)darker_image = enhancer.enhance(0.5)self.image_reference_tk = ImageTk.PhotoImage(darker_image.resize((int(486* (self.dpi / 100)), int(486* (self.dpi / 100))), Image.Resampling.LANCZOS))self.image_id = self.image_reference_canvas.create_image(0, 0, image=self.image_reference_tk, anchor='nw')self.image_reference_strength.set(0.6)self.information_extracted.set(1)686 unmodified linesself.resolution_button.grid(row=2, column=1, padx=5, sticky="w")self.sampler_label = customtkinter.CTkLabel(self.extended_right_frame, text="Sampler :", font=my_font)self.sampler_label.grid(row=2, column=2,pady=5, padx=15, sticky="w")self.sampler_var = customtkinter.StringVar(value="k_euler_ancestral + native")self.sampler_button = customtkinter.CTkComboBox(self.extended_right_frame, width=210,values=["k_euler + native", "k_euler + karras", "k_euler + exponential", "k_euler_ancestral + native", "k_euler_ancestral + exponential", "k_dpmpp_2s_ancestral + native", "k_dpmpp_2s_ancestral + exponential", "k_dpmpp_sde + native", "k_dpmpp_sde + karras", "k_dpmpp_sde + exponential", "k_dpmpp_2m + native", "k_dpmpp_2m + karras", "k_dpmpp_2m + exponential"], variable=self.sampler_var, font=my_font)self.sampler_button.grid(row=2, column=2, columnspan=2, pady=5, padx=15, sticky="e")self.show_fullscreen_btn = customtkinter.CTkButton(self.extended_right_frame, text="전체화면(ESC닫기)", font=my_font, command=self.show_fullscreen_image)self.show_fullscreen_btn.grid(row=2, column=4,pady=5, padx=5, sticky="nsew")53 unmodified linesif current_size != app.last_window_size:app.last_window_size = current_sizeif app.state() == 'zoomed':self.hidden_frame.configure(width=round(360 * (app.dpi /100), 0))if app.dpi >= 100 and app.dpi < 125 : offset = 10elif app.dpi >= 125 and app.dpi < 150 : offset = 5elif app.dpi >= 150: offset = 043 unmodified linesself.resolution_button2.grid(row=3, column=1, padx=5, sticky="w")self.sampler_label2 = customtkinter.CTkLabel(self.hidden_frame, text="Sampler :", font=my_font)self.sampler_label2.grid(row=4, column=0,pady=5, padx=5, sticky="w")self.sampler_button2 = customtkinter.CTkComboBox(self.hidden_frame, width=160,values=["k_euler + native", "k_euler + karras", "k_euler + exponential", "k_euler_ancestral + native", "k_euler_ancestral + exponential", "k_dpmpp_2s_ancestral + native", "k_dpmpp_2s_ancestral + exponential", "k_dpmpp_sde + native", "k_dpmpp_sde + karras", "k_dpmpp_sde + exponential", "k_dpmpp_2m + native", "k_dpmpp_2m + karras", "k_dpmpp_2m + exponential"], variable=self.sampler_var, font=my_font)self.sampler_button2.grid(row=4, column=1, columnspan=2, pady=5, padx=5, sticky="e")self.cfg_scale_label2 = customtkinter.CTkLabel(self.hidden_frame, text="CFG Scale : ", font=my_font)self.cfg_scale_label2.grid(row=5, column=0,pady=5, padx=5, sticky="w")230 unmodified linesexcept:i2i_negative_text = self.negative_prompt_input.get("0.0", "end-1c")inpaint_check = sum(sum(row) for row in mirror_image) >= 50_sampler, _noise_schedule = app.sampler_button.get().split(' + ')gen_request = {"width":self.i2i_width if not inpaint_check else cwidth ,"height":self.i2i_height if not inpaint_check else cheight,"quality_toggle":self.auto_quality_toggle.get(),"seed":request_seed if self.i2i_seed_hold_check == True else random.randint(0,9999999999),"sampler":_sampler,"noise_schedule": _noise_schedule,"scale":scale_pre,"uncond_scale":uncond_pre,"sema":self.sema_button.get(),103 unmodified linesiimg = Noneinpaint_mode = Falseiimg = Image.open(filename).convert("RGBA")original_image = iimg.copy()cwidth, cheight = iimg.sizecurrent_dpi = app.dpi289 unmodified linesdef i2i_set_image_reference():filepath = filedialog.askopenfilename(title="Open Image", filetypes=[("Image files", "*.png;*.jpg;*.webp"), ("All files", "*.*")])if filepath:i2irf["image_reference"] = Image.open(filepath).convert('RGBA')i2irf["image_reference_string"] = NAIA_generation.image_to_base64(i2irf["image_reference"])enhancer = ImageEnhance.Brightness(i2irf["image_reference"])darker_image = enhancer.enhance(0.5)i2irf["image_reference_tk"] = ImageTk.PhotoImage(darker_image.resize((int(486* (self.dpi / 100)), int(486* (self.dpi / 100))), Image.Resampling.LANCZOS))i2irf["image_id"] = image_reference_canvas.create_image(0, 0, image=i2irf["image_reference_tk"], anchor='nw')image_reference_strength.set(0.6)information_extracted.set(1)19 unmodified linesi2irf["image_id"] = Noneimage_reference_frame = customtkinter.CTkFrame(i2i_generate_frame)image_reference_canvas = customtkinter.CTkCanvas(image_reference_frame, width=int(486 * (app.dpi / 100)), height=200,bg="#333333", highlightthickness = 1, highlightbackground = 'grey10')image_reference_canvas.grid(row=0, column=0, columnspan=4, padx=5, pady=5, sticky="n")image_reference_strength_label = customtkinter.CTkLabel(image_reference_canvas, font=v_large_font, text_color='white', text=f"Reference Strength : 0.6", fg_color='transparent', width=190)information_extracted_label = customtkinter.CTkLabel(image_reference_canvas, font=v_large_font, text_color='white', text=f"Information Extracted : 1", fg_color='transparent', width=190)image_reference_strength = customtkinter.CTkSlider(image_reference_canvas, from_=0.01, to=1.00, number_of_steps=100, command=slider_event_IRS, button_color='grey', button_hover_color='grey10', height=20, progress_color='transparent')information_extracted = customtkinter.CTkSlider(image_reference_canvas, from_=0.01, to=1.00, number_of_steps=100, command=slider_event_IE, button_color='grey', button_hover_color='grey10', height=20, progress_color='transparent')exit_reference_mode = customtkinter.CTkButton(image_reference_canvas, text="Vibe Transfer 해제", font=my_font, command=lambda: i2i_rem_image_reference(i2irf), fg_color='grey10', hover_color='grey', corner_radius=0)irc_xpos = [int(110* (self.dpi / 100)), int(110* (self.dpi / 100)), int(320* (self.dpi / 100)), int(320* (self.dpi / 100)), int(240* (self.dpi / 100))]image_reference_canvas.create_window(irc_xpos[0], 120, window=image_reference_strength_label)image_reference_canvas.create_window(irc_xpos[1], 70, window=information_extracted_label)image_reference_canvas.create_window(irc_xpos[2], 120, window=image_reference_strength)43 unmodified linesself.uncond_strength_entry.delete(0, "end")self.uncond_strength_entry.insert(0, "1.0")i2i_negative_text = self.negative_prompt_input.get("0.0", "end-1c")_sampler, _noise_schedule = app.sampler_button.get().split(' + ')gen_request = {"width":self.i2i_width,"height":self.i2i_height,"quality_toggle":self.auto_quality_toggle.get(),"seed":request_seed if self.i2i_seed_hold_check == True else random.randint(0,9999999999),"sampler":_sampler,"noise_schedule": _noise_schedule,"scale":scale_pre,"uncond_scale":uncond_pre,"sema":self.sema_button.get(),103 unmodified linesself.after(1000, update_rating)self.after(2000, self.get_winfo_fpixels)self.initialize_ui(self.select_rating_frame, my_font, update_labels, perform_search, depth_search)self.after(3000, initialize_reference)def get_winfo_fpixels(self):ps_script = '''26 unmodified lines'''# PowerShell 명령어 실행result = subprocess.run(['powershell', '-Command', ps_script], capture_output=True, text=True)self.dpi = int(float(result.stdout.strip()))def initialize_ui(self, frame, my_font, update_labels, perform_search, depth_search):self.search_button = customtkinter.CTkButton(71 unmodified linesself.image_reference_canvas.delete(self.image_id)self.image_id = Nonereference_string = NAIA_generation.image_to_base64(img)self.image_reference = copy.deepcopy(img.convert('RGBA'))self.image_reference_string = reference_stringenhancer = ImageEnhance.Brightness(self.image_reference)darker_image = enhancer.enhance(0.5)self.image_reference_tk = ImageTk.PhotoImage(darker_image.resize((int(486* (self.dpi / 100)), int(486* (self.dpi / 100))), Image.Resampling.LANCZOS))self.image_id = self.image_reference_canvas.create_image(0, 0, image=self.image_reference_tk, anchor='nw')self.image_reference_strength.set(0.6)self.information_extracted.set(1)90 unmodified lineswidth, height = img.sizenew_size = max(width, height)new_image = Image.new("RGBA", (new_size, new_size), 'black')left = (new_size - width) // 2top = (new_size - height) // 2new_image.paste(img, (left, top))99 unmodified lines# 이미지 객체로부터 키워드 추출description = extract_keywords_from_image(img)img = img.convert('RGBA')if description == '' or description == None:returnelif type(description) == type(' '):22 unmodified lineswidth, height = img.sizenew_size = max(width, height)new_image = Image.new("RGBA", (new_size, new_size), 'black')left = (new_size - width) // 2top = (new_size - height) // 2new_image.paste(img, (left, top))425 unmodified linesself.prompt_guidance_rescale_var.set(settings["guidance"])except: passtry:if settings["sampler"] == "k_euler_ancestral" : settings["sampler"] = "k_euler_ancestral + native"self.sampler_var.set(settings["sampler"])self.sampler_button.set(settings["sampler"])except: pass143 unmodified linesresized_image = image.resize((new_width, new_height), Image.Resampling.LANCZOS)# 새 이미지 (배경) 생성new_image = Image.new("RGBA", (max_width, max_height), "black")# 리사이즈된 이미지를 새 이미지의 중앙에 배치paste_x = (max_width - new_width) // 2355 unmodified linesapp.image_reference_canvas.delete(app.image_id)app.image_id = Nonereference_string = NAIA_generation.image_to_base64(img)app.image_reference = copy.deepcopy(img.convert('RGBA'))app.image_reference_string = reference_stringenhancer = ImageEnhance.Brightness(app.image_reference)darker_image = enhancer.enhance(0.5)app.image_reference_tk = ImageTk.PhotoImage(darker_image.resize((int(486* (self.dpi / 100)), int(486* (self.dpi / 100))), Image.Resampling.LANCZOS))app.image_id = app.image_reference_canvas.create_image(0, 0, image=app.image_reference_tk, anchor='nw')app.image_reference_strength.set(_irs)app.image_reference_strength_label.configure(text=f"Reference Strength : {_irs:.2f}")486 unmodified linesuncond_pre = 1.0self.uncond_strength_entry.delete(0, "end")self.uncond_strength_entry.insert(0, "1.0")_sampler, _noise_schedule = app.sampler_button.get().split(' + ')_gen_request = {"width":NAI_width,"height":NAI_height,"quality_toggle":self.auto_quality_toggle.get(),"seed":self.seed_entry.get(),"sampler":_sampler,"noise_schedule": _noise_schedule,"scale":scale_pre,"uncond_scale":uncond_pre,"sema":self.sema_button.get(),312 unmodified lines_random_seed = random.randint(0,9999999999)for _ni, insf in enumerate(contents):if _val and _val != _ni: continue_sampler, _noise_schedule = app.sampler_button.get().split(' + ')_gen_request = {"width":NAI_width,"height":NAI_height,"quality_toggle":self.auto_quality_toggle.get(),"seed": _random_seed,"sampler":_sampler,"noise_schedule": _noise_schedule,"scale":scale_pre,"uncond_scale":uncond_pre,"sema":self.sema_button.get(),
309 unmodified lines310311312313314315316309 unmodified lines"controlnet_strength": 1.0,"add_original_image": False,"cfg_rescale": gen_request["cfg_rescale"],"noise_schedule": "native"}if "reference_image" in gen_request:309 unmodified lines310311312313314315316309 unmodified lines"controlnet_strength": 1.0,"add_original_image": False,"cfg_rescale": gen_request["cfg_rescale"],"noise_schedule": gen_request["noise_schedule"]}if "reference_image" in gen_request:
Danbooru Prompt Selector/TEST2024/NAIA_0229_testv1.exe+2-2
Danbooru Prompt Selector/TEST2024/NAIA_0229_testv1.py+67-73
Danbooru Prompt Selector/TEST2024/NAIA_generation.py+1-1