Skip to content

Commit 7cff104

Browse files
author
legionfu
committed
删除多余print
1 parent 95adb3c commit 7cff104

File tree

1 file changed

+3
-38
lines changed

1 file changed

+3
-38
lines changed

scripts/state_api.py

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import scripts.lightspeedflow_config as lf_config
2626

2727
# current_path = os.path.abspath(os.path.dirname(__file__))
28-
# print(current_path)
2928
# sys.path.append(os.path.join(current_path,"lib"))
3029

3130
workflow_json = {}
@@ -43,20 +42,6 @@ def test_func():
4342
print("test_func")
4443
# print(parameters_copypaste.paste_fields)
4544

46-
# with open(shared.cmd_opts.ui_settings_file, mode='r', encoding='UTF-8') as f:
47-
# json_str = f.read()
48-
# config_json = json.loads(json_str)
49-
# print(config_json['localization'])
50-
# print(localization.localizations[config_json['localization']])
51-
52-
# data = "preprocessor: depth_midas, model: control_v11f1p_sd15_depth [cfd03158], \
53-
# weight: 0.95, starting/ending: (0.07, 0.93), resize mode: Just Resize, pixel perfect: True, \
54-
# control mode: My prompt is more important, preprocessor params: (512, 100, 200)"
55-
# res = re.findall(r"([^:]+:[^:]{1,})(,|$)",data)
56-
# print(res)
57-
#find_checkpoint_from_name("hanfuDreambooth_v12")
58-
#print(checkpoints_list)
59-
6045
def add_output_log(msg:str, style:str=""):
6146
global Output_Log
6247
print(f"Output_Log: {msg}")
@@ -69,7 +54,6 @@ def find_checkpoint_from_name(name:str):
6954
#print(checkpoint)
7055
#print(res.group(1))
7156
try:
72-
#print(res.group(1))
7357
if(res.group(1) == name):
7458
return checkpoint
7559
except:
@@ -80,9 +64,7 @@ def find_checkpoint_from_hash(hash:str):
8064

8165
for checkpoint in checkpoints_list.keys():
8266
res = re.search(r"\[([0-9a-fA-F]{10})\]", checkpoint)
83-
#print(checkpoint)
8467
try:
85-
#print(res.group(1))
8668
if(res.group(1) == hash):
8769
return checkpoint
8870
except:
@@ -102,9 +84,6 @@ def set_lightspeedflow_file():
10284
def on_after_component(component, **kwargs):
10385

10486
try:
105-
if(kwargs["elem_id"] == "img2img_image"):
106-
print(kwargs)
107-
10887
if(Webui_Comps.get(kwargs["elem_id"], None) == None):
10988
Webui_Comps[kwargs["elem_id"]] = component
11089
except BaseException as e:
@@ -119,7 +98,6 @@ def on_after_component(component, **kwargs):
11998
target_comps.append(State_Comps["json2js"]) # 触发事件传递json给js
12099
target_comps.append(State_Comps["outlog"][0])
121100
target_comps.append(State_Comps["outlog"][1]) # 因为显示日志的窗口分txt2img和img2img两个位置 所以两个位置同步导出
122-
# print(target_comps)
123101

124102
for btn in State_Comps["export"]:
125103
btn.click(None,_js="state.core.actions.exportState") #, inputs=[],outputs=[]
@@ -173,8 +151,8 @@ def func_for_invisiblebutton():
173151
pass
174152

175153
# try:
176-
# print(f"aaaaaaaaa {temp_index} {next_index} {len(Webui_Comps_Cur_Val)}")
177-
# print(f"aaaaaaaaa {lf_config.Image_Components_Key[temp_index]} {Webui_Comps_Cur_Val[temp_index]} ")
154+
# print(f"func_for_invisiblebutton {temp_index} {next_index} {len(Webui_Comps_Cur_Val)}")
155+
# print(f"func_for_invisiblebutton {lf_config.Image_Components_Key[temp_index]} {Webui_Comps_Cur_Val[temp_index]} ")
178156
# except:
179157
# pass
180158

@@ -191,7 +169,6 @@ def func_for_invisiblebutton():
191169

192170

193171
def fn_import_workflow(workflow_file):
194-
print(workflow_file)
195172
global workflow_json, Output_Log
196173
global Webui_Comps_Cur_Val, temp_index, next_index
197174
temp_index = -1 # 重置索引
@@ -218,7 +195,6 @@ def fn_import_workflow(workflow_file):
218195
successed = 2
219196
tempkey = key
220197
while successed > 0:
221-
#print(f"------{successed}-----{key}--")
222198
try:
223199
image_data = workflow_json[key]
224200
matchObj = re.match("data:image/[a-zA-Z0-9]+;base64,",image_data)
@@ -242,9 +218,6 @@ def fn_import_workflow(workflow_file):
242218
successed = 0
243219
successed-=1
244220

245-
# if(key == "img2img_image"):
246-
# test_component = image
247-
248221
Webui_Comps_Cur_Val.append(image)
249222

250223
# return_vals.append(str(time.time())) # 用来触发json2js事件,python设置完图片 js继续设置其他参数 弃用
@@ -310,7 +283,6 @@ def get_lightspeedflow_config(self, onlyimg:bool = False):
310283
for key in lf_config.Image_Components_Key:
311284
temp_json[key] = ""
312285

313-
# print(f"temp_json = {temp_json}")
314286
return json.dumps(temp_json)
315287

316288
def str_2_json(self, str_data:str):
@@ -325,8 +297,7 @@ def str_2_json(self, str_data:str):
325297
return out_json
326298

327299
def png_info(self, img_data:png_info_params):
328-
#print(img_data.img_path)
329-
300+
330301
geninfo, items = images.read_info_from_image(Image.open(img_data.img_path))
331302
geninfo = parse_generation_parameters(geninfo)
332303

@@ -335,9 +306,7 @@ def png_info(self, img_data:png_info_params):
335306

336307
matchObj = re.match("ControlNet ([0-9])", key)
337308
if(matchObj != None): # controlnet
338-
# print(matchObj.group(1))
339309
cn_info = self.str_2_json(geninfo[key])
340-
#print(cn_info)
341310
if(len(cn_info.keys()) > 0):
342311
temp_json["state-ext-control-net-txt2img_0-enable".replace("0",matchObj.group(1))] = True
343312

@@ -376,7 +345,6 @@ def png_info(self, img_data:png_info_params):
376345
if(key in ["Hires upscale","Hires steps","Hires upscaler","Hires resize-1","Hires resize-2"]):
377346
temp_json["state-txt2img_enable_hr"] = True
378347

379-
#print("----------------")
380348
print(temp_json)
381349

382350
return json.dumps(temp_json)
@@ -395,7 +363,6 @@ def get_img_elem_key(self):
395363

396364
def imgs_callback(self, img_data:imgs_callback_params):
397365
global workflow_json
398-
#print(f"imgs_callback = {id} {img}")
399366
workflow_json[img_data.id] = img_data.img
400367

401368
def refresh_ui(self):
@@ -457,7 +424,6 @@ def show(self, is_img2img):
457424
return scripts.AlwaysVisible
458425

459426
def ui(self, is_img2img):
460-
#print("state plugin ui")
461427
try:
462428
State_Comps["import"]
463429
State_Comps["export"]
@@ -480,7 +446,6 @@ def ui(self, is_img2img):
480446
<p style=color:Tomato;>Welcome to LightSpeedFlow! \(^o^)/~</p>
481447
<p style=color:MediumSeaGreen;>Welcome to LightSpeedFlow! \(^o^)/~</p>
482448
<p style=color:DodgerBlue;>Welcome to LightSpeedFlow! \(^o^)/~</p>'''))
483-
#print(State_Comps["import"])
484449

485450
with gr.Row():
486451
export_config = gr.Button(value='Export')

0 commit comments

Comments
 (0)