3131Auto_Fix_Params = lf_config .Auto_Fix_Params
3232LoRAs_In_Use = lf_config .LoRAs_In_Use
3333OutputPrompt = lf_config .OutputPrompt
34+ Local_Flows_Path = lf_config .Local_Flows_Path #"models/LightDiffusionFlow"
3435
3536# current_path = os.path.abspath(os.path.dirname(__file__))
3637# sys.path.append(os.path.join(current_path,"lib"))
5051txt2img_script_container = None
5152img2img_script_container = None
5253
53- local_flows_path = "models/LightDiffusionFlow"
54- if True :
55- flows_path = os .path .join (data_path , local_flows_path )
56- flows_path = flows_path .replace ("\\ " ,"/" ) # linux下反斜杠有问题
57- print (flows_path )
58- try :
59- if (not os .path .exists (flows_path )):
60- os .makedirs (flows_path )
61- if (os .path .exists (flows_path )):
62- print (f"本地文件夹'{ flows_path } '创建成功!" )
63- else :
64- print (f"本地文件夹'{ flows_path } '创建失败!" )
65- except BaseException as e :
66- pass
67-
68- if (not os .path .exists (flows_path )):
69- print (f"The creation of the folder '{ local_flows_path } ' has failed! Please create this folder manually to ensure the proper functioning of the extension." )
70- print (f"创建文件夹'{ local_flows_path } '失败!请手动创建该文件夹,以保证插件功能正常运行。" )
71-
7254local_flow_list = []
7355Need_Preload = False
7456Preload_File = r""
@@ -211,11 +193,11 @@ def SearchingCheckPointByHashFromCivitai(hash:str):
211193
212194def refresh_local_flows (* inputs ):
213195 print ("refresh_local_flows" )
214- global local_flow_list ,local_flows_path
196+ global local_flow_list ,Local_Flows_Path
215197 try :
216- flows_path = os .path .join (data_path , local_flows_path )
217- local_flow_list = [f for f in os .listdir (flows_path ) if os .path .isfile (
218- os .path .join (flows_path , f )) and os .path .splitext (f )[- 1 ] == '.flow' ]
198+ # flows_path = os.path.join(data_path, Local_Flows_Path )
199+ local_flow_list = [f for f in os .listdir (Local_Flows_Path ) if os .path .isfile (
200+ os .path .join (Local_Flows_Path , f )) and os .path .splitext (f )[- 1 ] == '.flow' ]
219201 except :
220202 local_flow_list = []
221203 # print(inputs)
@@ -231,11 +213,11 @@ def refresh_local_flows(*inputs):
231213 return ret
232214
233215def apply_local_flow (selected ):
234- global local_flow_list ,local_flows_path
216+ global local_flow_list ,Local_Flows_Path
235217 global Need_Preload ,Preload_File
236218
237219 if (selected != "" and selected != None ):
238- flow_path = os .path .join (data_path , local_flows_path , selected )
220+ flow_path = os .path .join (Local_Flows_Path , selected )
239221 if (os .path .exists (flow_path )):
240222 print ("OK,Local File!" )
241223 print (flow_path )
@@ -244,9 +226,9 @@ def apply_local_flow(selected):
244226 gr .Info (clear_markup (OutputPrompt .startimport ()))
245227
246228def delete_local_flow (selected ):
247- global local_flow_list ,local_flows_path
229+ global local_flow_list ,Local_Flows_Path
248230 if (selected != "" and selected != None ):
249- flow_path = os .path .join (data_path , local_flows_path , selected )
231+ flow_path = os .path .join (Local_Flows_Path , selected )
250232 if (os .path .exists (flow_path )):
251233 os .remove (flow_path )
252234 print ("Local File Deleted!" )
@@ -1014,7 +996,7 @@ def read_file(self, params:file_params):
1014996 def file_exist (self , params :file_params ):
1015997 print ("file_exist" )
1016998 if (not os .path .exists (params .file_path )):
1017- flow_path = os .path .join (data_path , local_flows_path , params .file_path )
999+ flow_path = os .path .join (Local_Flows_Path , params .file_path )
10181000 if (os .path .exists (flow_path )):
10191001 return True
10201002 else :
@@ -1084,7 +1066,7 @@ def need_preload(self):
10841066 return ""
10851067
10861068 def saveFlowToLocal (self , data_to_save :savefile_params ):
1087- global local_flows_path
1069+ global Local_Flows_Path
10881070 global add_output_log
10891071
10901072 overall_data = {}
@@ -1107,7 +1089,7 @@ def saveFlowToLocal(self, data_to_save:savefile_params):
11071089 # 过滤掉一些没用的默认值的信息
11081090 overall_data = config_filter (overall_data )
11091091
1110- flow_path = os .path .join (data_path , local_flows_path , data_to_save .file_name )
1092+ flow_path = os .path .join (Local_Flows_Path , data_to_save .file_name )
11111093 print (flow_path )
11121094 if (not os .path .exists (flow_path ) or (data_to_save .overwrite )):
11131095 with open (flow_path ,"w" ) as f :
@@ -1353,11 +1335,11 @@ def custom_ui(self):
13531335 if (Flow_Save_mode == "Core" ):
13541336 save_mode = " (only ControlNet)"
13551337
1356- global local_flow_list ,local_flows_path
1338+ global local_flow_list ,Local_Flows_Path
13571339 try :
1358- flows_path = os .path .join (data_path , local_flows_path )
1359- local_flow_list = [f for f in os .listdir (flows_path ) if os .path .isfile (
1360- os .path .join (flows_path , f )) and os .path .splitext (f )[- 1 ] == '.flow' ]
1340+ # flows_path = os.path.join(data_path, Local_Flows_Path )
1341+ local_flow_list = [f for f in os .listdir (Local_Flows_Path ) if os .path .isfile (
1342+ os .path .join (Local_Flows_Path , f )) and os .path .splitext (f )[- 1 ] == '.flow' ]
13611343 except :
13621344 local_flow_list = []
13631345
0 commit comments