jun34GTR commited on
Commit
214aebc
·
verified ·
1 Parent(s): be6b2a9

Delete WAI-NSFW-illustrious-character-select-EN

Browse files
WAI-NSFW-illustrious-character-select-EN/README.md DELETED
@@ -1,21 +0,0 @@
1
- # WAI-NSFW-illustrious-character-select-EN
2
-
3
- character select for WAI-NSFW-illustrious-SDXL
4
-
5
- WAI-NSFW-illustrious-SDXL
6
- https://civitai.com/models/827184?modelVersionId=1283437
7
-
8
-
9
- other dependence
10
-
11
- add-detail-xl
12
- https://huggingface.co/PvDeep/Add-Detail-XL/blob/main/add-detail-xl.safetensors
13
-
14
- Pony: People's Works - ponyv4_noob1_2_adamW-000017
15
- https://civitai.green/models/856285/pony-peoples-works?modelVersionId=1036362
16
-
17
- SPO-SDXL_4k-p_10ep_LoRA_webui
18
- https://civitai.com/models/510261/spo-sdxl4k-p10eplorawebui
19
-
20
- SDXL VAE
21
- https://civitai.com/models/296576?modelVersionId=333245
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
WAI-NSFW-illustrious-character-select-EN/character.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "random": ""
3
- }
 
 
 
 
WAI-NSFW-illustrious-character-select-EN/custom_character.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "random": ""
3
- }
 
 
 
 
WAI-NSFW-illustrious-character-select-EN/custom_settings.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "wai_json_url": "https://files.catbox.moe/6holoy.json",
3
- "neg_prompt": "lowres, (worst quality, bad quality:1.2), bad anatomy, sketch, jpeg artifacts, signature, watermark, old, oldest, censored, bar_censor, simple background, extra head, conjoined,",
4
- "steps": 40,
5
- "height": 1024,
6
- "width": 768,
7
- "more_detail": "<lora:add-detail-xl:1>,",
8
- "quality": "masterpiece,best quality,amazing quality,very aesthetic,absurdres,newest,huge filesize,<lora:spo_sdxl_10ep_4k-data_lora_webui:0.5>,",
9
- "character_enhance": "<lora:ponyv4_noob1_2_adamW-000017:0.8>,"
10
- }
 
 
 
 
 
 
 
 
 
 
 
WAI-NSFW-illustrious-character-select-EN/scripts/__pycache__/character_select.cpython-310.pyc DELETED
Binary file (21.9 kB)
 
WAI-NSFW-illustrious-character-select-EN/scripts/character_select.py DELETED
@@ -1,559 +0,0 @@
1
- import base64
2
- from cProfile import label
3
- import io
4
- import random
5
- from PIL import Image
6
- import gradio as gr
7
- import modules.sd_samplers
8
- import modules.scripts as scripts
9
- from modules import shared
10
- import json
11
- import os
12
- import shutil
13
- import requests
14
- import textwrap
15
- from pprint import pprint
16
- from modules.ui import gr_show
17
- from collections import namedtuple
18
- from pathlib import Path
19
- from urllib.parse import urlparse
20
-
21
-
22
- # ********* versioning *****
23
- repo = "a1111"
24
-
25
- try:
26
- import launch
27
-
28
- if not launch.is_installed("colorama"):
29
- launch.run_pip("install colorama")
30
- except:
31
- pass
32
-
33
- try:
34
- from colorama import just_fix_windows_console, Fore, Style
35
- just_fix_windows_console()
36
- except:
37
- pass
38
-
39
-
40
- class CharacterSelect(scripts.Script):
41
-
42
- BASEDIR = scripts.basedir()
43
-
44
- def __init__(self, *args, **kwargs):
45
- # components that pass through after_components
46
- self.all_components = []
47
-
48
- self.compinfo = namedtuple("CompInfo", ["component", "label", "elem_id", "kwargs"])
49
-
50
- self.settings_file = "settings.json"
51
- self.character_file = "character.json"
52
- self.action_file = "action.json"
53
- self.custom_settings_file = "custom_settings.json"
54
- self.custom_character_file = "custom_character.json"
55
- self.custom_action_file = "custom_action.json"
56
-
57
- # Read saved settings
58
- self.settings = self.get_config2(self.settings_file)
59
- self.character = self.get_config2(self.character_file)
60
-
61
- self.copy_json_file(self.settings_file,self.custom_settings_file)
62
- self.copy_json_file(self.character_file,self.custom_character_file)
63
-
64
- try:
65
- self.settings = self.get_config2(self.custom_settings_file)
66
- except:
67
- print(f"error:custom_settings '{self.custom_settings_file}' not exists")
68
-
69
- try:
70
- self.character = self.get_config2(self.custom_character_file)
71
- except:
72
- print(f"error:custom_character '{self.custom_character_file}' not exists")
73
-
74
-
75
- #設定
76
- self.hm_config_1 = "custom_character.json"
77
- self.hm_config_7 = "wai_character.json"
78
-
79
- if(self.chk_character(self.hm_config_7) == False):
80
- print("character file:" + self.settings["wai_json_url"] + " downloading...")
81
- self.download_json(self.settings["wai_json_url"], os.path.join(CharacterSelect.BASEDIR, "wai_character.json"))
82
- print("character file download finish")
83
-
84
- self.hm_config_1_component = self.get_config2(self.hm_config_1)
85
- for item in self.get_character(self.hm_config_7):
86
- self.hm_config_1_component.update({item : item})
87
-
88
- self.hm_config_1_img = self.get_characterimg(self.hm_config_7)
89
-
90
- self.hm1prompt = ""
91
-
92
- #text value
93
- self.hm1btntext = ""
94
- self.hm2btntext = ""
95
- self.hm3btntext = ""
96
- self.hm4btntext = ""
97
-
98
- self.locked1 = ""
99
- self.locked2 = ""
100
- self.locked3 = ""
101
- self.locked4 = ""
102
-
103
- #隨機的face也要記下來 避免蓋掉
104
- self.faceprompt = ""
105
-
106
- self.allfuncprompt = ""
107
-
108
- #前一次的 cprompt
109
- self.oldcprompt=""
110
-
111
- self.elm_prfx = "characterselect"
112
- CharacterSelect.txt2img_neg_prompt_btn = gr.Button(
113
- value="use default setting",
114
- variant="primary",
115
- render = False,
116
- elem_id=f"{self.elm_prfx}_neg_prompt_btn"
117
- )
118
- CharacterSelect.txt2img_radom_prompt_btn = gr.Button(
119
- value="radom Character",
120
- variant="primary",
121
- render = False,
122
- elem_id=f"{self.elm_prfx}_randomprompt_btn"
123
- )
124
-
125
- #h_m 人物
126
- CharacterSelect.txt2img_hm1_dropdown = gr.Dropdown(
127
- label="Character Select",
128
- choices=list(self.hm_config_1_component.keys()),
129
- render = False,
130
- elem_id=f"{self.elm_prfx}_hm1_dd"
131
- )
132
-
133
- CharacterSelect.txt2img_hm1_slider = gr.Slider(
134
- minimum = 0,
135
- maximum = len(self.hm_config_1_component) - 1,
136
- value = 0,
137
- step = 1,
138
- render = False,
139
- elem_id=f"{self.elm_prfx}_hm1_slider"
140
- )
141
-
142
- CharacterSelect.txt2img_hm1_img = gr.Image(
143
- width = 100
144
- )
145
-
146
- #功能性調節
147
- CharacterSelect.func01_chk =gr.Checkbox(
148
- label="more detail",
149
- render = False,
150
- container = False,
151
- elem_id=f"{self.elm_prfx}_func01_chk"
152
- )
153
- CharacterSelect.func03_chk = gr.Checkbox(
154
- label="quality",
155
- render = False,
156
- container = False,
157
- elem_id=f"{self.elm_prfx}_func03_chk"
158
- )
159
- CharacterSelect.func04_chk =gr.Checkbox(
160
- label="character enhance",
161
- render = False,
162
- container = False,
163
- elem_id=f"{self.elm_prfx}_func04_chk"
164
- )
165
-
166
- def title(self):
167
- return "CharacterSelect"
168
-
169
- def before_component(self, component, **kwargs):
170
- pass
171
- def _before_component(self, component, **kwargs):
172
- # Define location of where to show up
173
- #if kwargs.get("elem_id") == "":#f"{'txt2img' if self.is_txt2img else 'img2img'}_progress_bar":
174
- #print(kwargs.get("label") == self.before_component_label, "TEST", kwargs.get("label"))
175
- #if kwargs.get("label") == self.before_component_label:
176
- with gr.Row(equal_height = True):
177
- CharacterSelect.txt2img_neg_prompt_btn.render()
178
- with gr.Accordion(label="Character Select", open = True, elem_id=f"{'txt2img' if self.is_txt2img else 'img2img'}_preset_manager_accordion"):
179
- with gr.Row(equal_height = True):
180
- CharacterSelect.txt2img_hm1_dropdown.render()
181
- with gr.Row(equal_height = True):
182
- CharacterSelect.txt2img_hm1_slider.render()
183
- with gr.Row(equal_height = True):
184
- CharacterSelect.txt2img_hm1_img.render()
185
- with gr.Row(equal_height = True):
186
- CharacterSelect.txt2img_radom_prompt_btn.render()
187
- with gr.Accordion(label="Other Setting", open = False, elem_id=f"{'txt2img' if self.is_txt2img else 'img2img'}_h_setting_accordion"):
188
- with gr.Row(equal_height = True):
189
- CharacterSelect.func01_chk.render()
190
- CharacterSelect.func03_chk.render()
191
- CharacterSelect.func04_chk.render()
192
-
193
- def after_component(self, component, **kwargs):
194
- if hasattr(component, "label") or hasattr(component, "elem_id"):
195
- self.all_components.append(self.compinfo(
196
- component=component,
197
- label=component.label if hasattr(component, "label") else None,
198
- elem_id=component.elem_id if hasattr(component, "elem_id") else None,
199
- kwargs=kwargs
200
- )
201
- )
202
-
203
- label = kwargs.get("label")
204
- ele = kwargs.get("elem_id")
205
-
206
- # 提示詞
207
- if ele == "txt2img_prompt":
208
- self.prompt_component = component
209
- if ele == "txt2img_neg_prompt":
210
- self.neg_prompt_component = component
211
- if ele == "txt2img_steps":
212
- self.steps_component = component
213
- if ele == "txt2img_height":
214
- self.height_component = component
215
- if ele == "txt2img_width":
216
- self.width_component = component
217
-
218
- if ele == "txt2img_generation_info_button" or ele == "img2img_generation_info_button":
219
- self._ui()
220
-
221
- if ele == "txt2img_styles_dialog":
222
- self._before_component("")
223
-
224
- def ui(self, *args):
225
- pass
226
-
227
- def _ui(self):
228
- # Conditional for class members
229
- if self.is_txt2img:
230
- CharacterSelect.txt2img_neg_prompt_btn.click(
231
- fn=self.fetch_neg_prompt,
232
- outputs=[self.neg_prompt_component,self.steps_component,self.height_component,self.width_component]
233
- )
234
- #hm
235
- CharacterSelect.txt2img_hm1_dropdown.change(
236
- fn=self.hm1_setting,
237
- inputs=[CharacterSelect.txt2img_hm1_dropdown,self.prompt_component],
238
- outputs=[CharacterSelect.txt2img_hm1_img, self.prompt_component,CharacterSelect.txt2img_hm1_slider]
239
- )
240
- CharacterSelect.txt2img_hm1_slider.release(
241
- fn=self.hm1_setting2,
242
- inputs=[CharacterSelect.txt2img_hm1_slider,self.prompt_component],
243
- outputs=[CharacterSelect.txt2img_hm1_dropdown]
244
- )
245
-
246
- #細節功能
247
- detailinput = [self.prompt_component,CharacterSelect.func01_chk,CharacterSelect.func03_chk,CharacterSelect.func04_chk]
248
- CharacterSelect.func01_chk.change(
249
- fn=self.func_setting,
250
- inputs=detailinput,
251
- outputs=self.prompt_component
252
- )
253
- CharacterSelect.func03_chk.change(
254
- fn=self.func_setting,
255
- inputs=detailinput,
256
- outputs=self.prompt_component
257
- )
258
- CharacterSelect.func04_chk.change(
259
- fn=self.func_setting,
260
- inputs=detailinput,
261
- outputs=self.prompt_component
262
- )
263
- CharacterSelect.txt2img_radom_prompt_btn.click(
264
- fn=self.h_m_random_prompt,
265
- outputs=[self.prompt_component, CharacterSelect.txt2img_hm1_dropdown]
266
- )
267
-
268
-
269
- def f_b_syncer(self):
270
- """
271
- ?Front/Backend synchronizer?
272
- Not knowing what else to call it, simple idea, rough to figure out. When updating choices on the front-end, back-end isn't updated, make them both match
273
- https://github.com/gradio-app/gradio/discussions/2848
274
- """
275
- self.inspect_dd.choices = [str(x) for x in self.all_components]
276
- return [gr.update(choices=[str(x) for x in self.all_components]), gr.Button.update(visible=False)]
277
-
278
-
279
- def inspection_formatter(self, x):
280
- comp = self.all_components[x]
281
- text = f"Component Label: {comp.label}\nElement ID: {comp.elem_id}\nComponent: {comp.component}\nAll Info Handed Down: {comp.kwargs}"
282
- return text
283
-
284
-
285
- def run(self, p, *args):
286
- pass
287
-
288
- def get_config(self, path, open_mode='r'):
289
- file = os.path.join(CharacterSelect.BASEDIR, path)
290
- try:
291
- with open(file, open_mode) as f:
292
- as_dict = json.load(f)
293
- except FileNotFoundError as e:
294
- print(f"{e}\n{file} not found, check if it exists or if you have moved it.")
295
- return as_dict
296
-
297
- def get_config2(self, path, open_mode='r'):
298
- file = os.path.join(CharacterSelect.BASEDIR, path)
299
- try:
300
- with open(file, open_mode, encoding='utf-8') as f:
301
- as_dict = json.load(f)
302
- except FileNotFoundError as e:
303
- print(f"{e}\n{file} not found, check if it exists or if you have moved it.")
304
- return as_dict
305
-
306
- def chk_character(self, path, open_mode='r'):
307
- file = os.path.join(CharacterSelect.BASEDIR, path)
308
- try:
309
- with open(file, open_mode) as f:
310
- return True
311
- except FileNotFoundError as e:
312
- return False
313
-
314
- def get_character(self, path, open_mode='r'):
315
- file = os.path.join(CharacterSelect.BASEDIR, path)
316
- try:
317
- with open(file, open_mode) as f:
318
- as_dict = json.load(f)
319
- except FileNotFoundError as e:
320
- print(f"{e}\n{file} not found, check if it exists or if you have moved it.")
321
- return [item["title"] for item in as_dict["proj"]]
322
-
323
- def get_characterimg(self, path, open_mode='r'):
324
- file = os.path.join(CharacterSelect.BASEDIR, path)
325
- try:
326
- with open(file, open_mode) as f:
327
- as_dict = json.load(f)
328
- except FileNotFoundError as e:
329
- print(f"{e}\n{file} not found, check if it exists or if you have moved it.")
330
- return [{item["title"]:item["image"]} for item in as_dict["proj"]]
331
-
332
- #自訂提詞
333
- def fetch_valid_values_from_prompt(self):
334
- self.prompt_component.value = ""
335
- self.prompt_component.value += self.hm1prompt
336
- self.prompt_component.value += self.allfuncprompt
337
- return self.prompt_component.value
338
-
339
- #預設
340
- def fetch_neg_prompt(self):
341
- self.neg_prompt_component.value = self.settings["neg_prompt"]
342
- self.steps_component.value = self.settings["steps"]
343
- self.height_component.value = self.settings["height"]
344
- self.width_component.value = self.settings["width"]
345
- return [self.neg_prompt_component.value,self.steps_component.value,self.height_component.value,self.width_component.value]
346
-
347
- #隨機
348
- def h_m_random_prompt(self):
349
- self.prompt_component.value = ""
350
- self.hm1btntext = list(self.hm_config_1_component)[random.randint(1,len(self.hm_config_1_component)-1)]
351
- self.prompt_component.value += self.hm_config_1_component[self.hm1btntext] + ","
352
- self.prompt_component.value += self.allfuncprompt
353
-
354
- return [self.prompt_component.value, self.hm1btntext]
355
-
356
- #自訂1
357
- def hm1_setting(self, selection, oldprompt):
358
- if(selection == ""):
359
- selection = "random"
360
- oldhmprompt = self.hm1prompt
361
- self.hm1prompt = ""
362
- #自行異動
363
- if(self.hm1btntext != selection):
364
- self.locked1 = ""
365
- if(selection != "random"):
366
- self.hm1prompt = selection + ","
367
- self.hm1btntext = selection
368
- else:
369
- if(selection != "random"):
370
- self.hm1prompt = selection + ","
371
-
372
- if(oldhmprompt!=""):
373
- oldprompt = oldprompt.replace(", ",",").replace(oldhmprompt.replace(", ",","), self.hm1prompt)
374
- else:
375
- oldprompt += "," + self.hm1prompt
376
-
377
- value = "data:image/jpeg;base64,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AAAAAAAA83S2gsLjF6etOeWStj5ti/Et/YzNi5GTF9Msd8Vb+YahpHye2LN4W+Ml0QvTi/64rb4I6OP4nH66/hq24k/plr2M1Y0hT62HnJe9Vlan3RzfyNynMw2/V+WC2DJH2eTfCdeyyE63wshKD+ZnratvE7Y5iY8wh5zrL6QxcydJYOROhg5AZ01yseVcZTfCEXJ+CIm0V8yR38PVwerGkLsuRhbUn02R5pdvn5GvfmYaebR/wBZIw3nxDYdHeTe+WTxN0Ko+5UnZNrhm8kn4mnk+KVj6K7/AMs9eLafqluWhdVsFgspVV8q1ffWvl2dq6I9yRzc3Ly5fqnt6NmmGlPEPbNdlAAAAAAAAAAAAAAAAAAAAAAPjQFezAUT9emqXxVQf1RaL2jxMq9MeiB6DwT34XDPtw1X7F/n5P7p/Mo+XT0h8WgsCt2Ewy/y1X7D5+X+6fzJ8unpCevRuHh6tFMfhqgvois5Lz5tKemvosqKWxLJcEUWfQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/2Q=="
378
- index = 0
379
- i=0
380
- for item in self.hm_config_1_img:
381
- i+=1
382
- if(item.get(selection,'') != ''):
383
- value = item.get(selection)
384
- index = i
385
-
386
- #self.base64_to_pil(self.hm_config_1_img[0].get('hatsune miku'))
387
- return [self.base64_to_pil(value), oldprompt, index]
388
-
389
- def hm1_setting2(self, selection, oldprompt):
390
- return list(self.hm_config_1_component.keys())[selection]
391
-
392
- def hmzht_setting(self, selection, oldprompt):
393
- return self.localizations_component[selection]
394
-
395
-
396
- #細節
397
- def func_setting(self, oldprompt,fv1,fv3,fv4):
398
- self.allfuncprompt = ""
399
- oldprompt = oldprompt.replace(self.settings["more_detail"], "")
400
- oldprompt = oldprompt.replace(self.settings["quality"], "")
401
- oldprompt = oldprompt.replace(self.settings["character_enhance"], "")
402
- if(fv1):
403
- self.allfuncprompt += self.settings["more_detail"]
404
- if(fv3):
405
- self.allfuncprompt += self.settings["quality"]
406
- if(fv4):
407
- self.allfuncprompt += self.settings["character_enhance"]
408
- oldprompt += self.allfuncprompt
409
- return oldprompt
410
-
411
- def cprompt_send(self, oldprompt, input_prompt):
412
- generated_texts = []
413
- generated_texts = self.send_request(input_prompt)
414
- #clear beafore
415
- oldprompt = oldprompt.replace(self.oldcprompt, '')
416
- self.oldcprompt = ''
417
- for text in generated_texts:
418
- self.oldcprompt += text
419
- self.oldcprompt = self.oldcprompt.replace(", ", ",")
420
- oldprompt = oldprompt + ',' + self.oldcprompt
421
- print(f"llama3: {self.oldcprompt}")
422
- return oldprompt
423
-
424
- def send_request(self, input_prompt, **kwargs):
425
- prime_directive = textwrap.dedent("""\
426
- Act as a prompt maker with the following guidelines:
427
- - Break keywords by commas.
428
- - Provide high-quality, non-verbose, coherent, brief, concise, and not superfluous prompts.
429
- - Focus solely on the visual elements of the picture; avoid art commentaries or intentions.
430
- - Construct the prompt with the component format:
431
- 1. Start with the subject and keyword description.
432
- 2. Follow with motion keyword description.
433
- 3. Follow with scene keyword description.
434
- 4. Finish with background and keyword description.
435
- - Limit yourself to no more than 20 keywords per component
436
- - Include all the keywords from the user's request verbatim as the main subject of the response.
437
- - Be varied and creative.
438
- - Always reply on the same line and no more than 100 words long.
439
- - Do not enumerate or enunciate components.
440
- - Create creative additional information in the response.
441
- - Response in English.
442
- The followin is an illustartive example for you to see how to construct a prompt your prompts should follow this format but always coherent to the subject worldbuilding or setting and cosider the elemnts relationship.
443
- Example:
444
- Demon Hunter,Cyber City,A Demon Hunter,standing,lone figure,glow eyes,deep purple light,cybernetic exoskeleton,sleek,metallic,glowing blue accents,energy weapons,Fighting Demon,grotesque creature,twisted metal,glowing red eyes,sharp claws,towering structures,shrouded haze,shimmering energy,
445
- Make a prompt for the following Subject:
446
- """)
447
- data = {
448
- 'model': 'impactframes/llama3_ifai_sd_prompt_mkr_q4km:latest',
449
- 'messages': [
450
- {"role": "system", "content": prime_directive},
451
- {"role": "user", "content": input_prompt}
452
- ],
453
- }
454
- headers = kwargs.get('headers', {"Content-Type": "application/json"})
455
- base_url = f'http://127.0.0.1:11434/v1/chat/completions'
456
- response = requests.post(base_url, headers=headers, json=data)
457
-
458
- if response.status_code == 200:
459
- return response.json().get('choices', [{}])[0].get('message', {}).get('content', '')
460
- else:
461
- print(f"Error: Request failed with status code {response.status_code}")
462
- return []
463
-
464
- def local_request_restart(self):
465
- "Restart button"
466
- shared.state.interrupt()
467
- shared.state.need_restart = True
468
-
469
- def base64_to_pil(self, base64_str):
470
- """將 base64 字串轉換為 PIL Image"""
471
- if "base64," in base64_str: # 處理 data URL 格式
472
- base64_str = base64_str.split("base64,")[1]
473
-
474
- image_data = base64.b64decode(base64_str)
475
- image = Image.open(io.BytesIO(image_data))
476
- return image
477
-
478
- def copy_json_file(self, source_path: str, destination_path: str, overwrite: bool = False):
479
- """
480
- 複製JSON檔案並確認其格式正確
481
- Parameters:
482
- source_path (str): 來源JSON檔案的路徑
483
- destination_path (str): 目標位置的路徑
484
- overwrite (bool): 若為True則覆寫已存在的檔案,預設為False
485
- Returns:
486
- bool: 複製成功返回True,失敗返回False
487
- """
488
- try:
489
- # 確認來源檔案存在
490
- file = Path(os.path.join(CharacterSelect.BASEDIR, source_path))
491
- if not file.exists():
492
- print(f"錯誤:來源檔案 '{source_path}' 不存在")
493
- return False
494
-
495
- # 檢查目標檔案是否已存在
496
- dest = Path(os.path.join(CharacterSelect.BASEDIR, destination_path))
497
- if dest.exists() and not overwrite:
498
- return False
499
-
500
- # 讀取並驗證JSON格式
501
- #with open(file, 'r', encoding='utf-8') as file:
502
- # json.load(file) # 確認JSON格式正確
503
-
504
- # 建立目標資料夾(如果不存在)
505
- #dest.parent.mkdir(parents=True, exist_ok=True)
506
-
507
- # 複製檔案
508
- shutil.copy2(os.path.join(CharacterSelect.BASEDIR, source_path), os.path.join(CharacterSelect.BASEDIR, destination_path))
509
- print(f"成功:檔案已複製到 '{dest}'")
510
- return True
511
-
512
- except json.JSONDecodeError:
513
- print(f"錯誤:'{source_path}' 不是有效的JSON檔案")
514
- return False
515
- except Exception as e:
516
- print(f"錯誤:複製過程發生問題 - {str(e)}")
517
- return False
518
-
519
- def download_json(self, url, output_path, timeout:int=300):
520
- """
521
- 從網址下載 JSON 檔案並儲存
522
-
523
- Parameters:
524
- url (str): JSON 檔案的網址
525
- output_path (str): 儲存檔案的路徑
526
- headers (dict): 自訂的 HTTP headers
527
- timeout (int): 請求超時時間(秒)
528
-
529
- Returns:
530
- tuple: (下載的數據, 儲存路徑)
531
- """
532
- try:
533
- # 設定預設 headers
534
- default_headers = {
535
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
536
- }
537
-
538
- # 發送請求
539
- response = requests.get(url, headers=default_headers, timeout=timeout)
540
- response.raise_for_status() # 檢查是否請求成功
541
-
542
- # 嘗試解析 JSON
543
- data = response.json()
544
-
545
- # 儲存檔案
546
- with open(output_path, 'w', encoding='utf-8') as f:
547
- json.dump(data, f, ensure_ascii=False, indent=2)
548
-
549
- except requests.exceptions.RequestException as e:
550
- print(f"Download Error: {str(e)}")
551
- raise
552
- except json.JSONDecodeError as e:
553
- print(f"JSON 解析Error錯誤: {str(e)}")
554
- raise
555
- except Exception as e:
556
- print(f"Exception: {str(e)}")
557
- raise
558
-
559
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
WAI-NSFW-illustrious-character-select-EN/settings.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "wai_json_url": "https://files.catbox.moe/6holoy.json",
3
- "neg_prompt": "lowres, (worst quality, bad quality:1.2), bad anatomy, sketch, jpeg artifacts, signature, watermark, old, oldest, censored, bar_censor, simple background, extra head, conjoined,",
4
- "steps": 40,
5
- "height": 1024,
6
- "width": 768,
7
- "more_detail": "<lora:add-detail-xl:1>,",
8
- "quality": "masterpiece,best quality,amazing quality,very aesthetic,absurdres,newest,huge filesize,<lora:spo_sdxl_10ep_4k-data_lora_webui:0.5>,",
9
- "character_enhance": "<lora:ponyv4_noob1_2_adamW-000017:0.8>,"
10
- }
 
 
 
 
 
 
 
 
 
 
 
WAI-NSFW-illustrious-character-select-EN/wai_character.json DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:49e27e52c62d3ec47d27e5bf965b70da6b69c3365f2d3e1be639a168997183fb
3
- size 165269574