novelai-python 0.7.9__tar.gz → 0.7.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. {novelai_python-0.7.9 → novelai_python-0.7.10}/PKG-INFO +5 -3
  2. {novelai_python-0.7.9 → novelai_python-0.7.10}/README.md +4 -2
  3. {novelai_python-0.7.9 → novelai_python-0.7.10}/pyproject.toml +1 -1
  4. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/_enum.py +129 -40
  5. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/augment_image/_enum.py +2 -1
  6. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate_image/__init__.py +16 -2
  7. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate_image/params.py +24 -8
  8. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate_image/schema.py +2 -2
  9. {novelai_python-0.7.9 → novelai_python-0.7.10}/LICENSE +0 -0
  10. {novelai_python-0.7.9 → novelai_python-0.7.10}/NOTICE.MD +0 -0
  11. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/__init__.py +0 -0
  12. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_enum.py +0 -0
  13. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_exceptions.py +0 -0
  14. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/__init__.py +0 -0
  15. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/ai/__init__.py +0 -0
  16. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/ai/generate.py +0 -0
  17. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/ai/generate_image.py +0 -0
  18. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/ai/generate_stream.py +0 -0
  19. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/ai/generate_voice.py +0 -0
  20. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/ai/upscale.py +0 -0
  21. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/schema.py +0 -0
  22. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/user/__init__.py +0 -0
  23. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/user/information.py +0 -0
  24. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/user/login.py +0 -0
  25. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/_response/user/subscription.py +0 -0
  26. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/credential/ApiToken.py +0 -0
  27. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/credential/JwtToken.py +0 -0
  28. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/credential/UserAuth.py +0 -0
  29. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/credential/__init__.py +0 -0
  30. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/credential/_base.py +0 -0
  31. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/__init__.py +0 -0
  32. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/LICENSE +0 -0
  33. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/__init__.py +0 -0
  34. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/_const.py +0 -0
  35. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/_cost.py +0 -0
  36. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/augment_image/__init__.py +0 -0
  37. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate/__init__.py +0 -0
  38. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate/_const.py +0 -0
  39. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate/_enum.py +0 -0
  40. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate/_schema.py +0 -0
  41. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate/themes.json +0 -0
  42. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate_image/suggest_tags.py +0 -0
  43. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate_image/tokenizer.py +0 -0
  44. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate_stream.py +0 -0
  45. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate_voice/__init__.py +0 -0
  46. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/generate_voice/_enum.py +0 -0
  47. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/ai/upscale.py +0 -0
  48. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/schema.py +0 -0
  49. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/user/__init__.py +0 -0
  50. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/user/information.py +0 -0
  51. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/user/login.py +0 -0
  52. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/sdk/user/subscription.py +0 -0
  53. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/server.py +0 -0
  54. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tokenizer/__init__.py +0 -0
  55. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tokenizer/clip_simple_tokenizer.py +0 -0
  56. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tokenizer/nerdstash_v1.model +0 -0
  57. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tokenizer/nerdstash_v2.model +0 -0
  58. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tokenizer/novelai.model +0 -0
  59. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tokenizer/novelai_v2.model +0 -0
  60. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tool/__init__.py +0 -0
  61. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tool/image_metadata/__init__.py +0 -0
  62. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tool/image_metadata/bch_utils.py +0 -0
  63. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tool/image_metadata/lsb_extractor.py +0 -0
  64. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tool/image_metadata/lsb_injector.py +0 -0
  65. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tool/paint_mask/__init__.py +0 -0
  66. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tool/random_prompt/__init__.py +0 -0
  67. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tool/random_prompt/generate_scene_composition.py +0 -0
  68. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tool/random_prompt/generate_scene_tags.py +0 -0
  69. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/tool/random_prompt/generate_tags.py +0 -0
  70. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/utils/__init__.py +0 -0
  71. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/utils/encode.py +0 -0
  72. {novelai_python-0.7.9 → novelai_python-0.7.10}/src/novelai_python/utils/useful.py +0 -0
  73. {novelai_python-0.7.9 → novelai_python-0.7.10}/tests/__init__.py +0 -0
  74. {novelai_python-0.7.9 → novelai_python-0.7.10}/tests/test_generate_voice.py +0 -0
  75. {novelai_python-0.7.9 → novelai_python-0.7.10}/tests/test_random_prompt.py +0 -0
  76. {novelai_python-0.7.9 → novelai_python-0.7.10}/tests/test_server.py +0 -0
  77. {novelai_python-0.7.9 → novelai_python-0.7.10}/tests/test_server_run.py +0 -0
  78. {novelai_python-0.7.9 → novelai_python-0.7.10}/tests/test_tokenizer.py +0 -0
  79. {novelai_python-0.7.9 → novelai_python-0.7.10}/tests/test_upscale.py +0 -0
  80. {novelai_python-0.7.9 → novelai_python-0.7.10}/tests/test_user_information.py +0 -0
  81. {novelai_python-0.7.9 → novelai_python-0.7.10}/tests/test_user_login.py +0 -0
  82. {novelai_python-0.7.9 → novelai_python-0.7.10}/tests/test_user_subscription.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: novelai-python
3
- Version: 0.7.9
3
+ Version: 0.7.10
4
4
  Summary: NovelAI Python Binding With Pydantic
5
5
  Author-Email: sudoskys <coldlando@hotmail.com>
6
6
  License: Apache License 2.0
@@ -48,10 +48,11 @@ Description-Content-Type: text/markdown
48
48
  The goal of this repository is to use Pydantic to build legitimate requests to access
49
49
  the [NovelAI API service](https://api.novelai.net/docs).
50
50
 
51
- > Python >= 3.9 is required.
51
+ > Python >= 3.9 <3.13 is required.
52
52
 
53
53
  ### 📰 News
54
54
 
55
+ - [New Model. No Restrictions. V4.5 Full Is Here.](https://blog.novelai.net/novelai-diffusion-v4-5-full-release-678318c86205)
55
56
  - [NovelAI Diffusion V4.5 Curated is Here!](https://blog.novelai.net/novelai-diffusion-v4-5-curated-is-here-9e5ba1f628f3)
56
57
  - [Image Generation Model Release — NovelAI Anime Diffusion V4 Curated Preview (EN)](https://blog.novelai.net/release-novelai-anime-diffusion-v4-curated-preview-en-ca4b0b11e671)
57
58
  - [Tutorial: Creating Consistent Characters with NovelAI Diffusion Anime [Female]](https://blog.novelai.net/tutorial-en-creating-consistent-characters-with-novelai-diffusion-anime-female-538b4b678a4e)
@@ -88,7 +89,7 @@ prompt = "2girls, fisheye, closeup, from above"
88
89
  async def main():
89
90
  gen = GenerateImageInfer.build_generate(
90
91
  prompt=prompt,
91
- model=Model.NAI_DIFFUSION_4_5_CURATED,
92
+ model=Model.NAI_DIFFUSION_4_5_FULL,
92
93
  character_prompts=[
93
94
  Character(
94
95
  prompt="1girl, head tilt, short hair, black hair, grey eyes, small breasts, looking at viewer",
@@ -107,6 +108,7 @@ async def main():
107
108
  qualityToggle=True,
108
109
  decrisp_mode=False,
109
110
  variety_boost=True,
111
+ furry_mode=False,
110
112
  # Checkbox in novelai.net
111
113
  )
112
114
  cost = gen.calculate_cost(is_opus=True)
@@ -10,10 +10,11 @@
10
10
  The goal of this repository is to use Pydantic to build legitimate requests to access
11
11
  the [NovelAI API service](https://api.novelai.net/docs).
12
12
 
13
- > Python >= 3.9 is required.
13
+ > Python >= 3.9 <3.13 is required.
14
14
 
15
15
  ### 📰 News
16
16
 
17
+ - [New Model. No Restrictions. V4.5 Full Is Here.](https://blog.novelai.net/novelai-diffusion-v4-5-full-release-678318c86205)
17
18
  - [NovelAI Diffusion V4.5 Curated is Here!](https://blog.novelai.net/novelai-diffusion-v4-5-curated-is-here-9e5ba1f628f3)
18
19
  - [Image Generation Model Release — NovelAI Anime Diffusion V4 Curated Preview (EN)](https://blog.novelai.net/release-novelai-anime-diffusion-v4-curated-preview-en-ca4b0b11e671)
19
20
  - [Tutorial: Creating Consistent Characters with NovelAI Diffusion Anime [Female]](https://blog.novelai.net/tutorial-en-creating-consistent-characters-with-novelai-diffusion-anime-female-538b4b678a4e)
@@ -50,7 +51,7 @@ prompt = "2girls, fisheye, closeup, from above"
50
51
  async def main():
51
52
  gen = GenerateImageInfer.build_generate(
52
53
  prompt=prompt,
53
- model=Model.NAI_DIFFUSION_4_5_CURATED,
54
+ model=Model.NAI_DIFFUSION_4_5_FULL,
54
55
  character_prompts=[
55
56
  Character(
56
57
  prompt="1girl, head tilt, short hair, black hair, grey eyes, small breasts, looking at viewer",
@@ -69,6 +70,7 @@ async def main():
69
70
  qualityToggle=True,
70
71
  decrisp_mode=False,
71
72
  variety_boost=True,
73
+ furry_mode=False,
72
74
  # Checkbox in novelai.net
73
75
  )
74
76
  cost = gen.calculate_cost(is_opus=True)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "novelai-python"
3
- version = "0.7.9"
3
+ version = "0.7.10"
4
4
  description = "NovelAI Python Binding With Pydantic"
5
5
  authors = [
6
6
  { name = "sudoskys", email = "coldlando@hotmail.com" },
@@ -94,6 +94,9 @@ class Model(Enum):
94
94
  """
95
95
  Nai Diffusion series
96
96
  """
97
+ NAI_DIFFUSION_4_5_FULL = "nai-diffusion-4-5-full"
98
+ NAI_DIFFUSION_4_5_FULL_INPAINTING = 'nai-diffusion-4-5-full-inpainting'
99
+
97
100
  NAI_DIFFUSION_4_5_CURATED = 'nai-diffusion-4-5-curated'
98
101
  NAI_DIFFUSION_4_5_CURATED_INPAINTING = 'nai-diffusion-4-5-curated-inpainting'
99
102
 
@@ -141,7 +144,8 @@ INPAINTING_MODEL_LIST = [
141
144
  Model.NAI_DIFFUSION_FURRY_3_INPAINTING,
142
145
  Model.NAI_DIFFUSION_4_CURATED_INPAINTING,
143
146
  Model.NAI_DIFFUSION_4_FULL_INPAINTING,
144
- Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING
147
+ Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING,
148
+ Model.NAI_DIFFUSION_4_5_FULL_INPAINTING,
145
149
  ]
146
150
 
147
151
  PROMOTION = {
@@ -158,17 +162,27 @@ PROMOTION = {
158
162
  "Stable Diffusion XL B0BDF6C1": Model.NAI_DIFFUSION_3,
159
163
  "Stable Diffusion XL C1E1DE52": Model.NAI_DIFFUSION_3,
160
164
  "Stable Diffusion XL 7BCCAA2C": Model.NAI_DIFFUSION_3,
165
+ "Stable Diffusion XL 1120E6A9": Model.NAI_DIFFUSION_3,
161
166
  "Stable Diffusion XL 8BA2AF87": Model.NAI_DIFFUSION_3,
162
167
  "Stable Diffusion XL 4BE8C60C": Model.NAI_DIFFUSION_FURRY_3,
163
168
  "Stable Diffusion XL C8704949": Model.NAI_DIFFUSION_FURRY_3,
164
169
  "Stable Diffusion XL 37C2B166": Model.NAI_DIFFUSION_FURRY_3,
170
+ "Stable Diffusion XL F306816B": Model.NAI_DIFFUSION_FURRY_3,
165
171
  "Stable Diffusion XL 9CC2F394": Model.NAI_DIFFUSION_FURRY_3,
166
- 'NovelAI Diffusion V4 4F49EC75': Model.NAI_DIFFUSION_4_FULL,
167
- 'NovelAI Diffusion V4 CA4B7203': Model.NAI_DIFFUSION_4_FULL,
172
+ 'NovelAI Diffusion V4.5 B9F340FD': Model.NAI_DIFFUSION_4_5_FULL,
173
+ 'NovelAI Diffusion V4.5 F3D95188': Model.NAI_DIFFUSION_4_5_FULL,
168
174
  'NovelAI Diffusion V4.5 5AB81C7C': Model.NAI_DIFFUSION_4_5_CURATED,
169
175
  "NovelAI Diffusion V4.5 B5A2A797": Model.NAI_DIFFUSION_4_5_CURATED,
170
176
  "NovelAI Diffusion V4 5AB81C7C": Model.NAI_DIFFUSION_4_5_CURATED,
171
177
  "NovelAI Diffusion V4 B5A2A797": Model.NAI_DIFFUSION_4_5_CURATED,
178
+ "NovelAI Diffusion V4 37442FCA": Model.NAI_DIFFUSION_4_FULL,
179
+ "NovelAI Diffusion V4 4F49EC75": Model.NAI_DIFFUSION_4_FULL,
180
+ "NovelAI Diffusion V4 CA4B7203": Model.NAI_DIFFUSION_4_FULL,
181
+ "NovelAI Diffusion V4 79F47848": Model.NAI_DIFFUSION_4_FULL,
182
+ "NovelAI Diffusion V4 F6302A9D": Model.NAI_DIFFUSION_4_FULL,
183
+ "NovelAI Diffusion V4 7ABFFA2A": Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
184
+ "NovelAI Diffusion V4 C1CCBA86": Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
185
+ "NovelAI Diffusion V4 770A9E12": Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
172
186
  }
173
187
 
174
188
  ModelTypeAlias = Optional[Union[Model, str]]
@@ -198,6 +212,9 @@ class SupportCondition:
198
212
  numericEmphasis: bool
199
213
  encodedVibes: bool
200
214
  cfgDelaySigma: int
215
+ enhancePromptAdd: bool # For enhance mode, see https://github.com/llmkira/novelai-python/blob/main/playground/enhance.py
216
+ hasFurryMode: bool
217
+ img2imgInpainting: bool
201
218
 
202
219
 
203
220
  def get_supported_params(model: Model):
@@ -237,7 +254,10 @@ def get_supported_params(model: Model):
237
254
  scaleRecommendedMax=25,
238
255
  numericEmphasis=False,
239
256
  encodedVibes=False,
240
- cfgDelaySigma=19
257
+ cfgDelaySigma=19,
258
+ enhancePromptAdd=False,
259
+ hasFurryMode=False,
260
+ img2imgInpainting=False
241
261
  )
242
262
  if model in [Model.NAI_DIFFUSION_2]:
243
263
  return SupportCondition(
@@ -260,7 +280,10 @@ def get_supported_params(model: Model):
260
280
  scaleRecommendedMax=25,
261
281
  numericEmphasis=False,
262
282
  encodedVibes=False,
263
- cfgDelaySigma=19
283
+ cfgDelaySigma=19,
284
+ enhancePromptAdd=False,
285
+ hasFurryMode=False,
286
+ img2imgInpainting=False
264
287
  )
265
288
  if model in [
266
289
  Model.NAI_DIFFUSION_XL,
@@ -289,7 +312,10 @@ def get_supported_params(model: Model):
289
312
  scaleRecommendedMax=8,
290
313
  numericEmphasis=False,
291
314
  encodedVibes=False,
292
- cfgDelaySigma=19
315
+ cfgDelaySigma=19,
316
+ enhancePromptAdd=False,
317
+ hasFurryMode=False,
318
+ img2imgInpainting=False
293
319
  )
294
320
  if model in [
295
321
  Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
@@ -299,8 +325,8 @@ def get_supported_params(model: Model):
299
325
  ]:
300
326
  return SupportCondition(
301
327
  controlnet=False,
302
- vibetransfer=False,
303
- scaleMax=20,
328
+ vibetransfer=True,
329
+ scaleMax=10,
304
330
  negativePromptGuidance=True,
305
331
  noiseSchedule=True,
306
332
  inpainting=True,
@@ -317,7 +343,10 @@ def get_supported_params(model: Model):
317
343
  scaleRecommendedMax=6,
318
344
  numericEmphasis=True,
319
345
  encodedVibes=True,
320
- cfgDelaySigma=19
346
+ cfgDelaySigma=19,
347
+ enhancePromptAdd=False,
348
+ hasFurryMode=True,
349
+ img2imgInpainting=False
321
350
  )
322
351
  if model in [Model.CUSTOM]:
323
352
  return SupportCondition(
@@ -340,11 +369,16 @@ def get_supported_params(model: Model):
340
369
  scaleRecommendedMax=None,
341
370
  numericEmphasis=True,
342
371
  encodedVibes=True,
343
- cfgDelaySigma=58
372
+ cfgDelaySigma=58,
373
+ enhancePromptAdd=False,
374
+ hasFurryMode=True,
375
+ img2imgInpainting=False
344
376
  )
345
377
  if model in [
346
378
  Model.NAI_DIFFUSION_4_5_CURATED,
347
379
  Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING,
380
+ Model.NAI_DIFFUSION_4_5_FULL,
381
+ Model.NAI_DIFFUSION_4_5_FULL_INPAINTING,
348
382
  ]:
349
383
  return SupportCondition(
350
384
  controlnet=False,
@@ -366,7 +400,10 @@ def get_supported_params(model: Model):
366
400
  scaleRecommendedMax=None,
367
401
  numericEmphasis=True,
368
402
  encodedVibes=False,
369
- cfgDelaySigma=58
403
+ cfgDelaySigma=58,
404
+ enhancePromptAdd=True,
405
+ hasFurryMode=True,
406
+ img2imgInpainting=False
370
407
  )
371
408
  return SupportCondition(
372
409
  controlnet=False,
@@ -388,7 +425,10 @@ def get_supported_params(model: Model):
388
425
  scaleRecommendedMax=99,
389
426
  numericEmphasis=False,
390
427
  encodedVibes=False,
391
- cfgDelaySigma=19
428
+ cfgDelaySigma=19,
429
+ enhancePromptAdd=False,
430
+ hasFurryMode=False,
431
+ img2imgInpainting=False
392
432
  )
393
433
 
394
434
 
@@ -400,7 +440,7 @@ class Modifier(object):
400
440
 
401
441
  def find_model_by_hashcode(hashcode: str) -> ModelTypeAlias:
402
442
  if "NovelAI Diffusion V4.5" in hashcode:
403
- return PROMOTION.get(hashcode, Model.NAI_DIFFUSION_4_5_CURATED)
443
+ return PROMOTION.get(hashcode, Model.NAI_DIFFUSION_4_5_FULL)
404
444
  if "NovelAI Diffusion V4" in hashcode:
405
445
  return PROMOTION.get(hashcode, Model.NAI_DIFFUSION_4_CURATED_PREVIEW)
406
446
  return PROMOTION.get(hashcode, None)
@@ -414,6 +454,14 @@ def get_modifiers(model: Model) -> Modifier:
414
454
  """
415
455
  if model in [
416
456
  Model.CUSTOM,
457
+ Model.NAI_DIFFUSION_4_5_FULL,
458
+ Model.NAI_DIFFUSION_4_5_FULL_INPAINTING
459
+ ]:
460
+ return Modifier(
461
+ qualityTags="",
462
+ suffix=", location, very aesthetic, masterpiece, no text"
463
+ )
464
+ if model in [
417
465
  Model.NAI_DIFFUSION_4_5_CURATED,
418
466
  Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING
419
467
  ]:
@@ -487,6 +535,8 @@ def filter_by_model_noise_schedule(model: Model, noise_schedule: List[NoiseSched
487
535
  if model in [
488
536
  Model.NAI_DIFFUSION_4_5_CURATED,
489
537
  Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING,
538
+ Model.NAI_DIFFUSION_4_5_FULL,
539
+ Model.NAI_DIFFUSION_4_5_FULL_INPAINTING,
490
540
  Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
491
541
  Model.NAI_DIFFUSION_4_FULL,
492
542
  Model.NAI_DIFFUSION_4_FULL_INPAINTING,
@@ -547,34 +597,42 @@ def get_default_noise_schedule(sample_type: Sampler) -> NoiseSchedule:
547
597
 
548
598
 
549
599
  def get_model_group(model: ModelTypeAlias) -> ModelGroups:
550
- # 一般情况禁止转换
551
- if isinstance(model, Enum):
552
- model = model.value
553
- else:
554
- model = str(model)
600
+ """
601
+ Get model group
602
+ If the model is not in the mapping, return STABLE_DIFFUSION
603
+ :param model: Model enum or model name string
604
+ :return: Model group
605
+ """
606
+ if isinstance(model, str):
607
+ try:
608
+ model = Model(model)
609
+ except ValueError:
610
+ return ModelGroups.STABLE_DIFFUSION
555
611
  mapping = {
556
- "stable-diffusion": ModelGroups.STABLE_DIFFUSION,
557
- "nai-diffusion": ModelGroups.STABLE_DIFFUSION,
558
- "safe-diffusion": ModelGroups.STABLE_DIFFUSION,
559
- "waifu-diffusion": ModelGroups.STABLE_DIFFUSION,
560
- "nai-diffusion-furry": ModelGroups.STABLE_DIFFUSION,
561
- "curated-diffusion-test": ModelGroups.STABLE_DIFFUSION,
562
- "nai-diffusion-inpainting": ModelGroups.STABLE_DIFFUSION,
563
- "safe-diffusion-inpainting": ModelGroups.STABLE_DIFFUSION,
564
- "furry-diffusion-inpainting": ModelGroups.STABLE_DIFFUSION,
565
- "nai-diffusion-2": ModelGroups.STABLE_DIFFUSION_GROUP_2,
566
- "nai-diffusion-xl": ModelGroups.STABLE_DIFFUSION_XL,
567
- "nai-diffusion-3": ModelGroups.STABLE_DIFFUSION_XL,
568
- "nai-diffusion-3-inpainting": ModelGroups.STABLE_DIFFUSION_XL,
569
- "custom": ModelGroups.V4,
570
- "nai-diffusion-furry-3": ModelGroups.STABLE_DIFFUSION_XL_FURRY,
571
- "nai-diffusion-furry-3-inpainting": ModelGroups.STABLE_DIFFUSION_XL_FURRY,
572
- "nai-diffusion-4-curated-preview": ModelGroups.V4,
573
- 'nai-diffusion-4-full': ModelGroups.V4,
574
- 'nai-diffusion-4-full-inpainting': ModelGroups.V4,
575
- 'nai-diffusion-4-curated-inpainting': ModelGroups.V4,
576
- 'nai-diffusion-4-5-curated': ModelGroups.V4,
577
- 'nai-diffusion-4-5-curated-inpainting': ModelGroups.V4,
612
+ Model.STABLE_DIFFUSION: ModelGroups.STABLE_DIFFUSION,
613
+ Model.NAI_DIFFUSION: ModelGroups.STABLE_DIFFUSION,
614
+ Model.SAFE_DIFFUSION: ModelGroups.STABLE_DIFFUSION,
615
+ Model.WAIFU_DIFFUSION: ModelGroups.STABLE_DIFFUSION,
616
+ Model.NAI_DIFFUSION_FURRY: ModelGroups.STABLE_DIFFUSION,
617
+ Model.CURATED_DIFFUSION_TEST: ModelGroups.STABLE_DIFFUSION,
618
+ Model.NAI_DIFFUSION_INPAINTING: ModelGroups.STABLE_DIFFUSION,
619
+ Model.SAFE_DIFFUSION_INPAINTING: ModelGroups.STABLE_DIFFUSION,
620
+ Model.FURRY_DIFFUSION_INPAINTING: ModelGroups.STABLE_DIFFUSION,
621
+ Model.NAI_DIFFUSION_2: ModelGroups.STABLE_DIFFUSION_GROUP_2,
622
+ Model.NAI_DIFFUSION_XL: ModelGroups.STABLE_DIFFUSION_XL,
623
+ Model.NAI_DIFFUSION_3: ModelGroups.STABLE_DIFFUSION_XL,
624
+ Model.NAI_DIFFUSION_3_INPAINTING: ModelGroups.STABLE_DIFFUSION_XL,
625
+ Model.CUSTOM: ModelGroups.V4,
626
+ Model.NAI_DIFFUSION_FURRY_3: ModelGroups.STABLE_DIFFUSION_XL_FURRY,
627
+ Model.NAI_DIFFUSION_FURRY_3_INPAINTING: ModelGroups.STABLE_DIFFUSION_XL_FURRY,
628
+ Model.NAI_DIFFUSION_4_CURATED_PREVIEW: ModelGroups.V4,
629
+ Model.NAI_DIFFUSION_4_FULL: ModelGroups.V4,
630
+ Model.NAI_DIFFUSION_4_FULL_INPAINTING: ModelGroups.V4,
631
+ Model.NAI_DIFFUSION_4_CURATED_INPAINTING: ModelGroups.V4,
632
+ Model.NAI_DIFFUSION_4_5_CURATED: ModelGroups.V4,
633
+ Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING: ModelGroups.V4,
634
+ Model.NAI_DIFFUSION_4_5_FULL: ModelGroups.V4,
635
+ Model.NAI_DIFFUSION_4_5_FULL_INPAINTING: ModelGroups.V4,
578
636
  }
579
637
  return mapping.get(model, ModelGroups.STABLE_DIFFUSION)
580
638
 
@@ -768,6 +826,37 @@ def get_uc_preset(model: ModelTypeAlias) -> List[UcPrompt]:
768
826
  text=""
769
827
  ),
770
828
  ]
829
+ elif model in [
830
+ Model.NAI_DIFFUSION_4_5_FULL,
831
+ Model.NAI_DIFFUSION_4_5_FULL_INPAINTING,
832
+ ]:
833
+ prompts = [
834
+ UcPrompt(
835
+ category="heavy",
836
+ name="heavy",
837
+ text="lowres, artistic error, film grain, scan artifacts, worst quality, bad quality, jpeg artifacts, very displeasing, chromatic aberration, dithering, halftone, screentone, multiple views, logo, too many watermarks, negative space, blank page"
838
+ ),
839
+ UcPrompt(
840
+ category="light",
841
+ name="light",
842
+ text="lowres, artistic error, scan artifacts, worst quality, bad quality, jpeg artifacts, multiple views, very displeasing, too many watermarks, negative space, blank page"
843
+ ),
844
+ UcPrompt(
845
+ category="furry",
846
+ name="furryFocus",
847
+ text="{worst quality}, distracting watermark, unfinished, bad quality, {widescreen}, upscale, {sequence}, {{grandfathered content}}, blurred foreground, chromatic aberration, sketch, everyone, [sketch background], simple, [flat colors], ych (character), outline, multiple scenes, [[horror (theme)]], comic"
848
+ ),
849
+ UcPrompt(
850
+ category="human",
851
+ name="humanFocus",
852
+ text="lowres, artistic error, film grain, scan artifacts, worst quality, bad quality, jpeg artifacts, very displeasing, chromatic aberration, dithering, halftone, screentone, multiple views, logo, too many watermarks, negative space, blank page, @_@, mismatched pupils, glowing eyes, bad anatomy"
853
+ ),
854
+ UcPrompt(
855
+ category="none",
856
+ name="none",
857
+ text=""
858
+ ),
859
+ ]
771
860
  return prompts
772
861
 
773
862
 
@@ -3,7 +3,7 @@ from enum import Enum
3
3
 
4
4
  class ReqType(Enum):
5
5
  """
6
- typing.Literal["bg-removal", "colorize", "lineart", "sketch", "emotion", "declutter"]
6
+ typing.Literal["bg-removal", "colorize", "lineart", "sketch", "emotion", "declutter", "declutter-keep-bubbles"]
7
7
  """
8
8
  BG_REMOVAL = "bg-removal"
9
9
  COLORIZE = "colorize"
@@ -11,6 +11,7 @@ class ReqType(Enum):
11
11
  SKETCH = "sketch"
12
12
  EMOTION = "emotion"
13
13
  DECLUTTER = "declutter"
14
+ DECLUTTER_KEEP_BUBBLES = "declutter-keep-bubbles"
14
15
 
15
16
 
16
17
  class Moods(Enum):
@@ -170,8 +170,13 @@ class GenerateImageInfer(ApiBaseModel):
170
170
  self.parameters.legacy_uc = get_supported_params(self.model).v4_0legacyUC
171
171
  if get_supported_params(self.model).v4Prompts:
172
172
  if self.parameters.v4_prompt is None:
173
+ # Remove furry tag from base caption
174
+ base_caption = self.input
175
+ if get_supported_params(self.model).hasFurryMode:
176
+ if base_caption.startswith("fur dataset, "):
177
+ base_caption = base_caption.replace("fur dataset, ", "")
173
178
  self.parameters.v4_prompt = V4Prompt.build_from_character_prompts(
174
- prompt=self.input,
179
+ base_caption=base_caption,
175
180
  character_prompts=self.parameters.characterPrompts
176
181
  )
177
182
  if self.parameters.v4_negative_prompt is None:
@@ -347,6 +352,12 @@ class GenerateImageInfer(ApiBaseModel):
347
352
  self.parameters.sm_dyn = False
348
353
  if self.parameters.image is None:
349
354
  raise ValueError("image is must required for img2img mode.")
355
+ # == Color Correction ==
356
+ if self.action == Action.IMG2IMG:
357
+ self.parameters.color_correct = True
358
+
359
+ if get_supported_params(self.model).img2imgInpainting and self.parameters.mask and self.parameters.inpaintImg2ImgStrength != 1:
360
+ self.parameters.color_correct = True
350
361
 
351
362
  return self
352
363
 
@@ -400,6 +411,7 @@ class GenerateImageInfer(ApiBaseModel):
400
411
  qualityToggle: bool = None,
401
412
  decrisp_mode: bool = None,
402
413
  variety_boost: bool = None,
414
+ furry_mode: bool = None,
403
415
  ):
404
416
  """
405
417
  Quickly construct a parameter class that meets the requirements.
@@ -425,6 +437,7 @@ class GenerateImageInfer(ApiBaseModel):
425
437
  :param qualityToggle: Use modifiers to make your images look more hentai.
426
438
  :param decrisp_mode: Reduce artifacts caused by high prompt guidance values.
427
439
  :param variety_boost: A new feature to improve the diversity of samples.
440
+ :param furry_mode: Whether to use furry mode.
428
441
  :return:
429
442
  """
430
443
  # Get default parameters for the model
@@ -463,7 +476,8 @@ class GenerateImageInfer(ApiBaseModel):
463
476
  params.dynamic_thresholding = decrisp_mode
464
477
  if variety_boost is not None:
465
478
  params.skip_cfg_above_sigma = get_supported_params(model).cfgDelaySigma if variety_boost else None
466
-
479
+ if furry_mode is True:
480
+ prompt = f"fur dataset, {prompt}"
467
481
  return GenerateImageInfer(
468
482
  input=prompt,
469
483
  model=model,
@@ -93,6 +93,11 @@ class Params(BaseModel):
93
93
  characterPrompts: List[Character] = Field(default_factory=list)
94
94
  """Character Prompts"""
95
95
 
96
+ color_correct: Optional[bool] = None
97
+ """For Inpaint"""
98
+ inpaintImg2ImgStrength: Optional[float] = Field(None, ge=0, le=1, multiple_of=0.01)
99
+ """For SameFeel"""
100
+
96
101
  v4_prompt: Optional[V4Prompt] = Field(None, description="V4 Prompt")
97
102
  """V4 Prompt"""
98
103
  v4_negative_prompt: Optional[V4NegativePrompt] = Field(None, description="V4 Negative Prompt")
@@ -358,7 +363,8 @@ def get_default_params(model: Model = None) -> Params:
358
363
  cfg_rescale=0.0,
359
364
  noise_schedule=NoiseSchedule.NATIVE,
360
365
  legacy_v3_extend=False,
361
- skip_cfg_above_sigma=None
366
+ skip_cfg_above_sigma=None,
367
+ params_version=3
362
368
  )
363
369
 
364
370
  if model == Model.NAI_DIFFUSION_2:
@@ -383,11 +389,11 @@ def get_default_params(model: Model = None) -> Params:
383
389
  cfg_rescale=0.0,
384
390
  noise_schedule=NoiseSchedule.NATIVE,
385
391
  legacy_v3_extend=False,
386
- skip_cfg_above_sigma=None
392
+ skip_cfg_above_sigma=None,
393
+ params_version=3
387
394
  )
388
395
 
389
396
  if model in [
390
- Model.CUSTOM,
391
397
  Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
392
398
  Model.NAI_DIFFUSION_4_FULL,
393
399
  Model.NAI_DIFFUSION_4_FULL_INPAINTING,
@@ -417,12 +423,17 @@ def get_default_params(model: Model = None) -> Params:
417
423
  skip_cfg_above_sigma=None,
418
424
  use_coords=False,
419
425
  legacy_uc=False,
420
- normalize_reference_strength_multiple=True
426
+ normalize_reference_strength_multiple=True,
427
+ inpaintImg2ImgStrength=1.0,
428
+ params_version=3
421
429
  )
422
430
 
423
431
  if model in [
432
+ Model.CUSTOM,
424
433
  Model.NAI_DIFFUSION_4_5_CURATED,
425
434
  Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING,
435
+ Model.NAI_DIFFUSION_4_5_FULL,
436
+ Model.NAI_DIFFUSION_4_5_FULL_INPAINTING,
426
437
  ]:
427
438
  return Params(
428
439
  width=832,
@@ -448,7 +459,9 @@ def get_default_params(model: Model = None) -> Params:
448
459
  skip_cfg_above_sigma=None,
449
460
  use_coords=False,
450
461
  legacy_uc=False,
451
- normalize_reference_strength_multiple=True
462
+ normalize_reference_strength_multiple=True,
463
+ inpaintImg2ImgStrength=1.0,
464
+ params_version=3
452
465
  )
453
466
 
454
467
  if model == Model.NAI_DIFFUSION_3:
@@ -473,7 +486,8 @@ def get_default_params(model: Model = None) -> Params:
473
486
  cfg_rescale=0.0,
474
487
  noise_schedule=NoiseSchedule.KARRAS,
475
488
  legacy_v3_extend=False,
476
- skip_cfg_above_sigma=None
489
+ skip_cfg_above_sigma=None,
490
+ params_version=3
477
491
  )
478
492
 
479
493
  if model == Model.NAI_DIFFUSION_FURRY_3:
@@ -498,7 +512,8 @@ def get_default_params(model: Model = None) -> Params:
498
512
  cfg_rescale=0.0,
499
513
  noise_schedule=NoiseSchedule.KARRAS,
500
514
  legacy_v3_extend=False,
501
- skip_cfg_above_sigma=None
515
+ skip_cfg_above_sigma=None,
516
+ params_version=3
502
517
  )
503
518
 
504
519
  # Default parameters if model is not specified or not matched
@@ -523,5 +538,6 @@ def get_default_params(model: Model = None) -> Params:
523
538
  cfg_rescale=0.0,
524
539
  noise_schedule=NoiseSchedule.NATIVE,
525
540
  legacy_v3_extend=False,
526
- skip_cfg_above_sigma=None
541
+ skip_cfg_above_sigma=None,
542
+ params_version=3
527
543
  )
@@ -89,7 +89,7 @@ class V4Prompt(BaseModel):
89
89
 
90
90
  @classmethod
91
91
  def build_from_character_prompts(cls,
92
- prompt: str,
92
+ base_caption: str,
93
93
  character_prompts: List[Character],
94
94
  use_coords: bool = True,
95
95
  use_order: bool = True
@@ -102,7 +102,7 @@ class V4Prompt(BaseModel):
102
102
  :param use_order: Whether to use order
103
103
  :return:
104
104
  """
105
- caption = Caption(base_caption=prompt)
105
+ caption = Caption(base_caption=base_caption)
106
106
  for character_prompt in character_prompts:
107
107
  char_caption = CharCaption(char_caption=character_prompt.prompt, centers=[character_prompt.center])
108
108
  caption.char_captions.append(char_caption)
File without changes