31
31
Auto_Fix_Params = lf_config .Auto_Fix_Params
32
32
LoRAs_In_Use = lf_config .LoRAs_In_Use
33
33
OutputPrompt = lf_config .OutputPrompt
34
+ Local_Flows_Path = lf_config .Local_Flows_Path #"models/LightDiffusionFlow"
34
35
35
36
# current_path = os.path.abspath(os.path.dirname(__file__))
36
37
# sys.path.append(os.path.join(current_path,"lib"))
50
51
txt2img_script_container = None
51
52
img2img_script_container = None
52
53
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
-
72
54
local_flow_list = []
73
55
Need_Preload = False
74
56
Preload_File = r""
@@ -211,11 +193,11 @@ def SearchingCheckPointByHashFromCivitai(hash:str):
211
193
212
194
def refresh_local_flows (* inputs ):
213
195
print ("refresh_local_flows" )
214
- global local_flow_list ,local_flows_path
196
+ global local_flow_list ,Local_Flows_Path
215
197
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' ]
219
201
except :
220
202
local_flow_list = []
221
203
# print(inputs)
@@ -231,11 +213,11 @@ def refresh_local_flows(*inputs):
231
213
return ret
232
214
233
215
def apply_local_flow (selected ):
234
- global local_flow_list ,local_flows_path
216
+ global local_flow_list ,Local_Flows_Path
235
217
global Need_Preload ,Preload_File
236
218
237
219
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 )
239
221
if (os .path .exists (flow_path )):
240
222
print ("OK,Local File!" )
241
223
print (flow_path )
@@ -244,9 +226,9 @@ def apply_local_flow(selected):
244
226
gr .Info (clear_markup (OutputPrompt .startimport ()))
245
227
246
228
def delete_local_flow (selected ):
247
- global local_flow_list ,local_flows_path
229
+ global local_flow_list ,Local_Flows_Path
248
230
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 )
250
232
if (os .path .exists (flow_path )):
251
233
os .remove (flow_path )
252
234
print ("Local File Deleted!" )
@@ -1014,7 +996,7 @@ def read_file(self, params:file_params):
1014
996
def file_exist (self , params :file_params ):
1015
997
print ("file_exist" )
1016
998
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 )
1018
1000
if (os .path .exists (flow_path )):
1019
1001
return True
1020
1002
else :
@@ -1084,7 +1066,7 @@ def need_preload(self):
1084
1066
return ""
1085
1067
1086
1068
def saveFlowToLocal (self , data_to_save :savefile_params ):
1087
- global local_flows_path
1069
+ global Local_Flows_Path
1088
1070
global add_output_log
1089
1071
1090
1072
overall_data = {}
@@ -1107,7 +1089,7 @@ def saveFlowToLocal(self, data_to_save:savefile_params):
1107
1089
# 过滤掉一些没用的默认值的信息
1108
1090
overall_data = config_filter (overall_data )
1109
1091
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 )
1111
1093
print (flow_path )
1112
1094
if (not os .path .exists (flow_path ) or (data_to_save .overwrite )):
1113
1095
with open (flow_path ,"w" ) as f :
@@ -1353,11 +1335,11 @@ def custom_ui(self):
1353
1335
if (Flow_Save_mode == "Core" ):
1354
1336
save_mode = " (only ControlNet)"
1355
1337
1356
- global local_flow_list ,local_flows_path
1338
+ global local_flow_list ,Local_Flows_Path
1357
1339
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' ]
1361
1343
except :
1362
1344
local_flow_list = []
1363
1345
0 commit comments