dikdimon commited on
Commit
29a5ed9
·
verified ·
1 Parent(s): 50261d7

Upload gf using SD-Hub extension

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +4 -0
  2. gf/LightDiffusionFlow/.gitignore +3 -0
  3. gf/LightDiffusionFlow/CONTRIBUTING.md +31 -0
  4. gf/LightDiffusionFlow/ChangeLog.md +126 -0
  5. gf/LightDiffusionFlow/LICENSE +237 -0
  6. gf/LightDiffusionFlow/LICENSES/Licenses.md +24 -0
  7. gf/LightDiffusionFlow/README.md +63 -0
  8. gf/LightDiffusionFlow/README_CN.md +62 -0
  9. gf/LightDiffusionFlow/__pycache__/preload.cpython-310.pyc +0 -0
  10. gf/LightDiffusionFlow/example/Product Design_线稿-工业产品.flow +21 -0
  11. gf/LightDiffusionFlow/example/lightflow艺术二维码.flow +36 -0
  12. gf/LightDiffusionFlow/install.py +6 -0
  13. gf/LightDiffusionFlow/javascript/state.app.js +4 -0
  14. gf/LightDiffusionFlow/javascript/state.constants.js +6 -0
  15. gf/LightDiffusionFlow/javascript/state.core.js +1006 -0
  16. gf/LightDiffusionFlow/javascript/state.ext.general.js +501 -0
  17. gf/LightDiffusionFlow/javascript/state.store.js +60 -0
  18. gf/LightDiffusionFlow/javascript/state.utils.js +684 -0
  19. gf/LightDiffusionFlow/preload.py +4 -0
  20. gf/LightDiffusionFlow/scripts/__pycache__/lightdiffusionflow_config.cpython-310.pyc +0 -0
  21. gf/LightDiffusionFlow/scripts/__pycache__/lightdiffusionflow_version.cpython-310.pyc +0 -0
  22. gf/LightDiffusionFlow/scripts/__pycache__/state_api.cpython-310.pyc +0 -0
  23. gf/LightDiffusionFlow/scripts/__pycache__/state_settings.cpython-310.pyc +0 -0
  24. gf/LightDiffusionFlow/scripts/lightdiffusionflow_config.py +320 -0
  25. gf/LightDiffusionFlow/scripts/lightdiffusionflow_version.py +1 -0
  26. gf/LightDiffusionFlow/scripts/state_api.py +1419 -0
  27. gf/LightDiffusionFlow/scripts/state_settings.py +52 -0
  28. gf/LightDiffusionFlow/style.css +20 -0
  29. gf/a1111-stable-diffusion-webui-vram-estimator/.gitignore +6 -0
  30. gf/a1111-stable-diffusion-webui-vram-estimator/LICENSE +9 -0
  31. gf/a1111-stable-diffusion-webui-vram-estimator/README.md +13 -0
  32. gf/a1111-stable-diffusion-webui-vram-estimator/scripts/__pycache__/vram_estimator.cpython-310.pyc +0 -0
  33. gf/a1111-stable-diffusion-webui-vram-estimator/scripts/vram_estimator.py +405 -0
  34. gf/a1111-stable-diffusion-webui-vram-estimator/static/preview.png +0 -0
  35. gf/asymmetric-tiling-sd-webui/.gitignore +1 -0
  36. gf/asymmetric-tiling-sd-webui/LICENSE +121 -0
  37. gf/asymmetric-tiling-sd-webui/README.md +22 -0
  38. gf/asymmetric-tiling-sd-webui/scripts/__pycache__/asymmetric_tiling.cpython-310.pyc +0 -0
  39. gf/asymmetric-tiling-sd-webui/scripts/asymmetric_tiling.py +116 -0
  40. gf/sd-webui-crop-extension/.gitignore +2 -0
  41. gf/sd-webui-crop-extension/install.py +6 -0
  42. gf/sd-webui-crop-extension/scripts/__pycache__/ui.cpython-310.pyc +0 -0
  43. gf/sd-webui-crop-extension/scripts/ui.py +32 -0
  44. gf/sd-webui-lua/.github/FUNDING.yml +1 -0
  45. gf/sd-webui-lua/.gitignore +1 -0
  46. gf/sd-webui-lua/LICENSE +674 -0
  47. gf/sd-webui-lua/README.md +38 -0
  48. gf/sd-webui-lua/examples/basics/README_example.lua +9 -0
  49. gf/sd-webui-lua/examples/basics/show_samplers.lua +10 -0
  50. gf/sd-webui-lua/examples/basics/simple_output.lua +21 -0
.gitattributes CHANGED
@@ -34,3 +34,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  fc/sd_webui_masactrl_orig/resources/img/xyz_grid-0010-1508457017.png filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  fc/sd_webui_masactrl_orig/resources/img/xyz_grid-0010-1508457017.png filter=lfs diff=lfs merge=lfs -text
37
+ gf/sd-webui-rich-text/assets/color.png filter=lfs diff=lfs merge=lfs -text
38
+ gf/sd-webui-rich-text/assets/font.png filter=lfs diff=lfs merge=lfs -text
39
+ gf/sd-webui-rich-text/assets/footnote.png filter=lfs diff=lfs merge=lfs -text
40
+ gf/sd-webui-rich-text/assets/size.png filter=lfs diff=lfs merge=lfs -text
gf/LightDiffusionFlow/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ .idea
2
+ __pycache__/
3
+ dev
gf/LightDiffusionFlow/CONTRIBUTING.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Contributing
2
+
3
+ 欢迎参与 LightDiffusionFlow 的贡献,你可以给我们提出意见、建议,报告 bug,或者贡献代码。在参与贡献之前,请阅读以下指引。
4
+
5
+ #### 咨询问题
6
+
7
+ 简单的咨询,如询问如何使用或其他StableDiffision相关的技术问题,请在官方微信群中询问,效率更高。
8
+
9
+ #### 关于 issue
10
+
11
+ 如果你对 LightDiffusionFlow 的现状有意见、建议或者发现了 bug,欢迎通过 issue 给我们提出。提 issue 之前,请阅读以下指引。
12
+
13
+ - 搜索以往的 issue ,看是否已经提过,避免重复提出;
14
+ - 请确认你遇到的问题,是否在最新版本已被修复;
15
+ - 如果是报告 bug,请尽量提供可以复现的条件:
16
+ - 操作系统、浏览器版本
17
+ - Stable Diffusion WebUI 版本以及相关插件的版本(如果有的话)
18
+ - LightDiffusionFlow 插件版本
19
+ - Bug 表现
20
+ - 操作步骤
21
+ - 是否必现
22
+ - 最好可以提供截图
23
+ - 如果你的问题已经得到解决,请关闭你的 issue。
24
+
25
+ #### 贡献者名单
26
+
27
+ 非常感谢以下几位对LightDiffusionFlow做出的贡献:
28
+
29
+ - 非常感谢 [Hali](https://github.com/ThisHaliHali) 为本项目提供的灵感、建议以及在开发期间的各种支持!
30
+
31
+ - 我们的项目是以 [Ilian Iliev](https://github.com/ilian6806) 的 [stable-diffusion-webui-state](https://github.com/ilian6806/stable-diffusion-webui-state) 项目为基础进行的二次开发,这为我们提供了很大的帮助,感谢 Ilian Iliev !
gf/LightDiffusionFlow/ChangeLog.md ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## 2.1.4
2
+
3
+ ### Features:
4
+ * 增加本地保存Flow配置功能,可直接下拉列表选择已保存的Flow文件。(导入或使用新flow之前,建议先刷新页面,目前插件暂时没有重置参数的功能)
5
+ * 增加记录额外LoRA模型数据,以便导入时从Civitai搜索缺失的lora模型。
6
+ * 模型模糊匹配优化,增加匹配子文件夹下的模型。
7
+ * 设置页面增加保存flow的默认路径选项,以及相同作用的命令行选项"--local-flows-path"。
8
+
9
+ ### Bug Fixes:
10
+ * 修复了部分已知的参数设置失败的问题,如ControlNet在Canny模式下的"Canny Low/Hight Threshold"等参数。
11
+
12
+
13
+ ## 2.1.3
14
+
15
+ ### Features:
16
+ * 缺失LoRA模型提示。
17
+ * 插件增加Core和ALL两种运行模式,Core模式仅支持WebUI的基本参数+ControlNet参数。All模式则会尽可能多的支持页面上的参数,但是缺点是有概率导致UI卡住,无限转圈。
18
+
19
+ ### Bug Fixes:
20
+ * 增加了错误参数纠正步骤,处理Controlnet tab保存序号错误的问题。
21
+ * 修复了一些已知的问题。
22
+ * 修复了一些img2img模式丢失的参数。
23
+
24
+
25
+ ## 2.1.2
26
+
27
+ ### Features:
28
+ * UI组件增加elem_id。
29
+ * flow文件导出时,支持自定义名称。
30
+ * ControlNet模型支持模糊匹配。
31
+ * 如本地没有ControlNet模型,会提供下载链接。
32
+ * 缺失插件提示。
33
+ * 插件增加中英文切换。
34
+
35
+ ### Bug Fixes:
36
+ * 图片组件保存功能优化,支持所有带elem_id的图片组件。
37
+ 因为gradio组件bug影响,目前暂时不支持不带elem_id的组件保存功能。
38
+ 目前新版本似乎已经修复,但秋叶启动器的gradio版本似乎还是旧版?待跟进。
39
+ issue链接: https://github.com/gradio-app/gradio/issues/5548
40
+ * refiner参数保存bug修复。
41
+ * 插件含tab的组件保存编号错误bug修复。
42
+ * 插件导入提示优化。
43
+ * 参数保存逻辑优化。
44
+ * 之前版本会保存多余参数,当前版本已修改,但注意缺失插件的提示,不一定是真的需要。
45
+
46
+ ## 2.1.1
47
+
48
+ ### Bug Fixes:
49
+ * sd webui v1.6.0 之前的版本兼容问题解决。
50
+
51
+ ## 2.1.0
52
+
53
+ ### Bug Fixes:
54
+ * py实现与js一样的创建组件编号,优化导入逻辑,部分dropdown组件改由py处理,降低UI面板无限转圈概率。
55
+ * 修复了一些已知的问题。
56
+
57
+ ### Features:
58
+ * UI面板挪到右侧,图片信息栏下方。
59
+
60
+ ## 2.0.4
61
+
62
+ ### Bug Fixes:
63
+ * 修复了部分插件tab面板以外的参数保存问题。
64
+ * 支持解析jpeg图片的png info。
65
+ * 修复了一些已知的问题。
66
+
67
+ ## 2.0.3
68
+
69
+ ### Bug Fixes:
70
+ * 修复了对比模型选项出现的bug。
71
+ * 修复了一些已知的问题。
72
+ * 确定了插件名称和文件后缀。
73
+
74
+ ### Features:
75
+ * 导入flow文件时,会自动在Civitai搜索相关模型,如果找到对应模型则提供下载链接。
76
+
77
+ ## 2.0.2
78
+
79
+ ### Bug Fixes:
80
+ * 修复了ControlNet max_models_num设置导致的错误。
81
+ * 修复了一些已知的问题。
82
+
83
+ ### Features:
84
+ * 支持到最新的WebUI v1.6.
85
+ * 设置模型时,支持单独匹配Hash或者文件名,满足其中一项就能设置成功。
86
+
87
+ ## 2.0.1
88
+
89
+ ### Bug Fixes:
90
+ * 修复了一些已知的问题。
91
+
92
+ ### Features:
93
+ * 增加HTTP调用接口,支持设置预加载文件。
94
+
95
+ ## 2.0.0
96
+
97
+ ### Bug Fixes:
98
+ * 现在可以更好的兼容汉化文件。
99
+
100
+ ### Features:
101
+ * 重写第三方插件支持代码,通用支持所有插件参数(不包括图片)。
102
+
103
+ ## 1.2.2
104
+
105
+ ### Features:
106
+ * 插件提示文字统一使用英文,插件说明文档调整并增加中文说明文档。
107
+
108
+ ## 1.2.1
109
+
110
+ ### Bug Fixes:
111
+ * png_info解析转换时,部分key值设置错误问题修复。
112
+
113
+ ## 1.2.0
114
+
115
+ ### Features:
116
+ * 添加支持解析图片文件,读取png info并还原到界面上
117
+
118
+ ### Bug Fixes:
119
+ * 解决了部分汉化文件读取错误的问题,现在可以更好的兼容汉化文件。
120
+
121
+ ## 1.1.3
122
+
123
+ ### Bug Fixes:
124
+ * 因“使用下拉菜单取代单选列表选项”导致部分选项设置不上的问题解决。
125
+ * 解决了一些venus平台和秋叶启动器上的兼容问题,秋叶启动器开启前需要关闭“启动云端页面汉化”选项。
126
+ * 页面已经设置了图片的选项再覆盖设置其他图片没有触发保存问题修复。
gf/LightDiffusionFlow/LICENSE ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Tencent is pleased to support the open source community by making LightDiffusionFlow (extension for Stable Diffusion) available.
2
+
3
+ Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved. The below software in this distribution may have been modified by THL A29 Limited ("Tencent Modifications"). All Tencent Modifications are Copyright (C) THL A29 Limited.
4
+
5
+ LightDiffusionFlow (extension for Stable Diffusion) is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE v3 except for the third-party components listed below.
6
+
7
+
8
+ Terms of the GNU AFFERO GENERAL PUBLIC LICENSE v3:
9
+ --------------------------------------------------------------------
10
+ GNU AFFERO GENERAL PUBLIC LICENSE
11
+ Version 3, 19 November 2007
12
+
13
+ Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
14
+ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
15
+
16
+ Preamble
17
+ The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
18
+
19
+ The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
20
+
21
+ When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
22
+
23
+ Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
24
+
25
+ A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
26
+
27
+ The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
28
+
29
+ An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
30
+
31
+ The precise terms and conditions for copying, distribution and modification follow.
32
+
33
+ TERMS AND CONDITIONS
34
+ 0. Definitions.
35
+ "This License" refers to version 3 of the GNU Affero General Public License.
36
+
37
+ "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
38
+
39
+ "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
40
+
41
+ To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
42
+
43
+ A "covered work" means either the unmodified Program or a work based on the Program.
44
+
45
+ To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
46
+
47
+ To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
48
+
49
+ An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
50
+
51
+ 1. Source Code.
52
+ The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
53
+
54
+ A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
55
+
56
+ The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
57
+
58
+ The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
59
+
60
+ The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
61
+
62
+ The Corresponding Source for a work in source code form is that same work.
63
+
64
+ 2. Basic Permissions.
65
+ All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
66
+
67
+ You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
68
+
69
+ Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
70
+
71
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
72
+ No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
73
+
74
+ When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
75
+
76
+ 4. Conveying Verbatim Copies.
77
+ You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
78
+
79
+ You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
80
+
81
+ 5. Conveying Modified Source Versions.
82
+ You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
83
+
84
+ a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
85
+ b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
86
+ c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
87
+ d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
88
+ A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
89
+
90
+ 6. Conveying Non-Source Forms.
91
+ You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
92
+
93
+ a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
94
+ b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
95
+ c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
96
+ d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
97
+ e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
98
+ A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
99
+
100
+ A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
101
+
102
+ "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
103
+
104
+ If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
105
+
106
+ The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
107
+
108
+ Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
109
+
110
+ 7. Additional Terms.
111
+ "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
112
+
113
+ When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
114
+
115
+ Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
116
+
117
+ a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
118
+ b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
119
+ c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
120
+ d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
121
+ e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
122
+ f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
123
+ All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
124
+
125
+ If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
126
+
127
+ Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
128
+
129
+ 8. Termination.
130
+ You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
131
+
132
+ However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
133
+
134
+ Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
135
+
136
+ Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
137
+
138
+ 9. Acceptance Not Required for Having Copies.
139
+ You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
140
+
141
+ 10. Automatic Licensing of Downstream Recipients.
142
+ Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
143
+
144
+ An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
145
+
146
+ You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
147
+
148
+ 11. Patents.
149
+ A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
150
+
151
+ A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
152
+
153
+ Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
154
+
155
+ In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
156
+
157
+ If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
158
+
159
+ If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
160
+
161
+ A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
162
+
163
+ Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
164
+
165
+ 12. No Surrender of Others' Freedom.
166
+ If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
167
+
168
+ 13. Remote Network Interaction; Use with the GNU General Public License.
169
+ Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
170
+
171
+ Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
172
+
173
+ 14. Revised Versions of this License.
174
+ The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
175
+
176
+ Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
177
+
178
+ If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
179
+
180
+ Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
181
+
182
+ 15. Disclaimer of Warranty.
183
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
184
+
185
+ 16. Limitation of Liability.
186
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
187
+
188
+ 17. Interpretation of Sections 15 and 16.
189
+ If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
190
+
191
+ END OF TERMS AND CONDITIONS
192
+
193
+ How to Apply These Terms to Your New Programs
194
+ If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
195
+
196
+ To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
197
+
198
+ <one line to give the program's name and a brief idea of what it does.>
199
+ Copyright (C) <year> <name of author>
200
+
201
+ This program is free software: you can redistribute it and/or modify
202
+ it under the terms of the GNU Affero General Public License as
203
+ published by the Free Software Foundation, either version 3 of the
204
+ License, or (at your option) any later version.
205
+
206
+ This program is distributed in the hope that it will be useful,
207
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
208
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
209
+ GNU Affero General Public License for more details.
210
+
211
+ You should have received a copy of the GNU Affero General Public License
212
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
213
+ Also add information on how to contact you by electronic and paper mail.
214
+
215
+ If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
216
+
217
+ You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>.
218
+
219
+
220
+
221
+ Other dependencies and licenses:
222
+
223
+
224
+ Open Source Software Licensed under the MIT License:
225
+ The below software in this distribution may have been modified by THL A29 Limited ("Tencent Modifications"). All Tencent Modifications are Copyright (C) 2023 THL A29 Limited.
226
+ --------------------------------------------------------------------
227
+ 1. stable-diffusion-webui-state
228
+ Copyright (c) 2023 Ilian Iliev
229
+
230
+
231
+ Terms of the MIT License:
232
+ --------------------------------------------------------------------
233
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
234
+
235
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
236
+
237
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
gf/LightDiffusionFlow/LICENSES/Licenses.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ## [stable-diffusion-webui-state](https://github.com/ilian6806/stable-diffusion-webui-state)
3
+
4
+ MIT License
5
+
6
+ Copyright (c) 2023 Ilian Iliev
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
gf/LightDiffusionFlow/README.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p float="left">
2
+ <img alt="" src="https://img.shields.io/badge/JavaScript-323330?style=for-the-badge&logo=javascript&logoColor=F7DF1E" />
3
+ <img alt="" src="https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python&logoColor=blue" />
4
+ </p>
5
+
6
+ # sd-webui-lightdiffusionflow
7
+
8
+ [**English**](./README.md) | [**中文**](./README_CN.md)
9
+
10
+ This extension is developed for AUTOMATIC1111's [Stable Diffusion web UI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) that provides import/export options for parameters.
11
+ "Stable Diffusion Web UI" hereafter referred to as "SD Web UI"
12
+ * [**Plugin demonstration and other instructions**](https://fvkij7wuqx9.feishu.cn/docx/HgZndihraotmmzxFni7cFZISnvb)
13
+ * [**LightFlow workflow community**](https://www.lightflow.ai/)
14
+ * [**Discord**](https://discord.gg/CaD4mchHxW)
15
+ * [**Twitter: @LightFlow_AI**](https://twitter.com/LightFlow_AI)
16
+
17
+
18
+ ### Capabilities
19
+
20
+ * Export/Import web UI parameters with a single file (images, inputs, sliders, checkboxes etc.) .
21
+ * Support parsing png info from image and restoring parameters back to the web UI.
22
+ * Supported extensions:
23
+ - In theory, it can support any plugin. (Except for certain plugin images, as they require the corresponding elem_id to be provided.)
24
+
25
+ ![lightflow_en](https://github.com/Tencent/LightDiffusionFlow/assets/20501414/e03cc556-9962-41a3-8738-606ee9e38a04)
26
+
27
+ ### Install
28
+
29
+ Use **Install from URL** option with this repo url.
30
+
31
+ ### Requirements
32
+
33
+ *None at all.*
34
+
35
+ ### Usage
36
+ * Export Parameters:
37
+ In the SD Web UI, configure the desired options, and click the "Export" button to export a flow file that records the current parameters.
38
+
39
+ * Import Parameters:
40
+ In the SD Web UI, click the "FileBox", select the corresponding flow file, and import the parameters from the file.
41
+ You can also directly drag and drop the flow file into the "FileBox" for importing.
42
+
43
+ **Currently, the plugin supports SD WebUI versions v1.5 and above, and compatibility testing for earlier versions has not been conducted.**
44
+ **If not due to compatibility issues with essential functionalities, it is strongly recommended to upgrade to version v1.6 or above before using this plugin!**
45
+
46
+ ### Examples
47
+
48
+ You can find several official examples in the example/ folder. If you want to try out more possibilities, please visit [**Our open-source community**](https://www.lightflow.ai/) for more public examples.
49
+
50
+ ### Contributing
51
+
52
+ If you have any comments, suggestions, or encounter issues with our project, please feel free to raise them through an issue, and we also welcome pull requests at any time!
53
+ You are also more than welcomed to share your own LightDiffusionFlow on [**Our open-source community**](https://www.lightflow.ai/).
54
+
55
+ ### Credits
56
+
57
+ Licenses for borrowed code can be found in LICENSES/[**Licenses.md**](./LICENSES/Licenses.md)
58
+
59
+ - stable-diffusion-webui-state - https://github.com/ilian6806/stable-diffusion-webui-state
60
+
61
+ *Our team urgently needs a solution to easily share the Stable Diffusion Web UI settings, and Ilian Iliev's stable-diffusion-webui-state project has been a great help to us. Thank you, Ilian Iliev!*
62
+
63
+ - Big thanks to [Hali](https://github.com/ThisHaliHali) for the inspiration, suggestions, and various forms of support during the development of this project. Much appreciated!
gf/LightDiffusionFlow/README_CN.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p float="left">
2
+ <img alt="" src="https://img.shields.io/badge/JavaScript-323330?style=for-the-badge&logo=javascript&logoColor=F7DF1E" />
3
+ <img alt="" src="https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python&logoColor=blue" />
4
+ </p>
5
+
6
+ # sd-webui-lightdiffusionflow
7
+
8
+ [**English**](./README.md) | [**中文**](./README_CN.md)
9
+
10
+ 这是为[Stable Diffusion Web UI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) 开发的一款导入/导出参数选项的插件。
11
+ Stable Diffusion Web UI 以下简称 SD Web UI。
12
+ * [**插件效果演示和其他说明**](https://fvkij7wuqx9.feishu.cn/docx/HgZndihraotmmzxFni7cFZISnvb)
13
+ * [**Lightflow开源社区**](https://www.lightflow.ai/)
14
+ * [**Discord**](https://discord.gg/CaD4mchHxW)
15
+ * [**Twitter: @LightFlow_AI**](https://twitter.com/LightFlow_AI)
16
+
17
+ ### 功能
18
+
19
+ * 实现单个文件导入/导出SD Web UI参数选项。
20
+ * 支持解析图片的PNG Info,并自动将参数恢复到SD Web UI面板上,包括部分插件参数。
21
+ * 目前支持的插件:
22
+ - 理论上来说,目前可以支持所有插件。
23
+ 部分插件的图片参数除外,因为必须要有对应的elem_id。
24
+
25
+ ![lightflow_CN](https://github.com/Tencent/LightDiffusionFlow/assets/20501414/492f7408-7729-4370-b0f9-c17a80211029)
26
+
27
+ ### 安装
28
+
29
+ 粘贴本项目链接到 **Install from URL** 选项里,点击安装按钮即可。
30
+
31
+ ### 插件依赖项
32
+
33
+
34
+
35
+ ### 用法
36
+
37
+ * 导出配置:
38
+ - 在SD Web UI上设置好合适的选项,点击Export按钮即可导出记录了当前设置的flow文件。
39
+ * 导入配置:
40
+ - 在SD Web UI上,点击文件框选择对应的flow文件,即可导入文件中的设置。
41
+ - 也可以直接把flow文件拖入文件框内完成导入。
42
+
43
+ **目前,该插件支持SD WebUI v1.5及以上版本,尚未对早期版本进行兼容性测试。**
44
+ **如果不是因为基本功能的兼容性问题,强烈建议在使用此插件之前升级到v1.6或更高版本。**
45
+ ### 注意事项
46
+
47
+ * 每次导入新的flow文件之前,最好刷新一下SD Web UI页面,因为插件只会修改已保存的参数选项。
48
+ * 插件当前版本不支持秋叶启动器的"云端汉化选项",使用本插件时建议关闭。
49
+
50
+ ### 插件共建
51
+
52
+ 如果你对我们的项目有意见、建议或者使用中遇到问题,欢迎通过 issue 给我们提出,也欢迎随时发起PR!
53
+
54
+ ### 感谢
55
+
56
+ 本项目参考和引用的第三方代码开源许可放在 LICENSES/[**Licenses.md**](./LICENSES/Licenses.md)
57
+
58
+ - stable-diffusion-webui-state - https://github.com/ilian6806/stable-diffusion-webui-state
59
+
60
+ *我们团队急需一个能快速分享 SD Web UI 设置的解决方案,Ilian Iliev 的 stable-diffusion-webui-state 项目为我们提供了很大的帮助,感谢 Ilian Iliev!*
61
+
62
+ - 非常感谢 [Hali](https://github.com/ThisHaliHali) 为本项目提供的灵感、建议以及在开发期间的各种支持!
gf/LightDiffusionFlow/__pycache__/preload.cpython-310.pyc ADDED
Binary file (445 Bytes). View file
 
gf/LightDiffusionFlow/example/Product Design_线稿-工业产品.flow ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "state-ext-control-net-txt2img_0-pixel-perfect": "true",
3
+ "state-ext-control-net-txt2img_0-model": "control_v11p_sd15_scribble [d4ba51ff]",
4
+ "state-txt2img_steps": "30",
5
+ "state-txt2img_height": "768",
6
+ "state-txt2img_seed": "1405674945",
7
+ "state-ext-control-net-txt2img-tab": "ControlNet Unit 0 [Scribble]",
8
+ "state-txt2img_neg_prompt": "colorful,illustration, painting, cartoons, sketch, (worst quality:2), (low quality:2), (normal quality:2), lowres, bad anatomy, bad hands, ((monochrome)), ((grayscale)), oversaturated, extra limb, missing limbs, deformed hands, long neck, long body, imperfect, (bad hands), signature, watermark, username, artist name, conjoined fingers, deformed fingers, ugly eyes, imperfect eyes, skewed eyes, unnatural face, unnatural body",
9
+ "state-ext-control-net-txt2img_0-preprocessor": "scribble_pidinet",
10
+ "state-txt2img_sampling": "DPM++ SDE Karras",
11
+ "state-ext-control-net-txt2img_0-allow-preview": "true",
12
+ "state-ext-control-net-txt2img_0-control-type": "Scribble",
13
+ "state-txt2img_enable_hr": "true",
14
+ "state-txt2img_hr_upscaler": "R-ESRGAN 4x+",
15
+ "state-tab": "txt2img",
16
+ "state-setting_sd_model_checkpoint": "chilloutmix_NiPrunedFp32Fix.safetensors [fc2511737a]",
17
+ "state-ext-control-net-txt2img_0-enable": "true",
18
+ "state-ext-control-net-txt2img-toggled": "false",
19
+ "state-txt2img_prompt": "product design,white material, Apple style,modern style,minimalist style,white background,classic color matching,light red,C4d rendering,ultra-high definition,32K UHD",
20
+ "txt2img_controlnet_ControlNet-0_input_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhwAAALQCAAAAAD+v/ZvAACgg0lEQVR4nOy9d5wkV3X2/z3nVnXPzkbtSlpplXOWUELkKEzO0SYZbILB5rVJr20MNsYYcCY6YptgcrRBZEQQAoEQyjmnlXa1q80z3XXveX5/9ITe3VkhtPP+1NOe5/ORZru7+nbVrafuPfmYmMc8Zobf3ycwj8HFPDnmsUvMk2Meu8Q8OeaxS8yTYx67xDw55rFLzJNjHrvEPDnmsUvMk2Meu8Q8OeaxS8yTYx67xDw55r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dKUvjj5d6YujT1f64ujTlb44+nSlL44+XemLo09X+uLo05W+OPp0pS+OPl3pi6NPV/ri6NOVvjj6dKUvjj5d6YujT1f64ujTlb44+nSlL44+XemLo09X+uLo05W+OPp0pS+OPl3pi6NPV/ri6NOVvjj6dKUvjj5d6YujT1f64ujTlb44+nSlL44+XemLo09X+uLo05W+OPp0pS+OPl3pi6NPV/ri6NOVvjj6dKUvjj5d6YujT1f+H89ZERddMTXsAAAAAElFTkSuQmCC"
21
+ }
gf/LightDiffusionFlow/example/lightflow艺术二维码.flow ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "state-ext-control-net-txt2img_0-pixel-perfect": "true",
3
+ "state-ext-control-net-txt2img_0-model": "control_v1p_sd15_qrcode_monster [a6e58995]",
4
+ "state-ext-control-net-txt2img_3-control-weight": "0.4",
5
+ "state-txt2img_seed": "2587406147",
6
+ "state-ext-control-net-txt2img_3-enabled": "true",
7
+ "state-ext-control-net-txt2img_0-ending-control-step": "0.87",
8
+ "state-ext-control-net-txt2img-tab": "ControlNet Unit 1 ",
9
+ "state-ext-control-net-txt2img_0-guidance-start-(t)": "0.21",
10
+ "state-setting_sd_model_checkpoint": "天空之境.safetensors [c1d961233a]",
11
+ "state-txt2img_sampling": "DPM++ 2M Karras",
12
+ "state-ext-control-net-txt2img_0-active": "true",
13
+ "state-ext-control-net-txt2img_3-pixel-perfect": "true",
14
+ "state-ext-control-net-txt2img_3-enable": "true",
15
+ "state-ext-control-net-txt2img_0-starting-control-step": "0.21",
16
+ "state-tab": "txt2img",
17
+ "state-ext-control-net-txt2img_0-enabled": "true",
18
+ "state-ext-control-net-txt2img_0-control-weight": "1.2",
19
+ "state-ext-control-net-txt2img_3-guidance-end-(t)": "0.75",
20
+ "state-txt2img_steps": "30",
21
+ "state-txt2img_height": "768",
22
+ "state-ext-control-net-txt2img_1-model": "control_v1p_sd15_brightness [5f6aa6ed]",
23
+ "state-ext-control-net-txt2img_3-model": "control_v1p_sd15_brightness [5f6aa6ed]",
24
+ "state-ext-control-net-txt2img_3-active": "true",
25
+ "state-ext-control-net-txt2img_0-guidance-end-(t)": "0.87",
26
+ "state-txt2img_prompt": "A RAW photo of a delicious plate of Rice,chocolate rice dumpling shrimp,mixed vegetables,thinly sliced chicken in a coconut milk curry sauce,hyperrealism,hyperrealistic,octane render,hyper detailed,8K,",
27
+ "state-txt2img_neg_prompt": "(worst quality, low quality:1.4), negative_hand Negative Embedding, verybadimagenegative_v1.3, 2girls, nsfw:1.4, bad anatomy, bad hands, cropped, missing fingers, too many fingers, missing arms, long neck, Humpbacked, deformed, disfigured, poorly drawn face, distorted face, mutation, mutated, extra limb, ugly, poorly drawn hands, missing limb, floating limbs, disconnected limbs, malformed hands, out of focus, long body, missing toes, too many toes, monochrome, symbol, text, logo, door frame, window frame, mirror frame, ",
28
+ "state-txt2img_width": "768",
29
+ "state-ext-control-net-txt2img_3-guidance-start-(t)": "0.45",
30
+ "state-ext-control-net-txt2img_3-ending-control-step": "0.75",
31
+ "state-ext-control-net-txt2img_3-starting-control-step": "0.45",
32
+ "state-ext-control-net-txt2img_0-enable": "true",
33
+ "state-ext-control-net-txt2img-toggled": "false",
34
+ "txt2img_controlnet_ControlNet-0_input_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAOpUlEQVR42u3cPY7iWhCA0d4OCRIkkJmdwX6ICRCBnRGwBXZC4JGROpgfjehpxvfeqvNJzp6s50u5Tr8X+GOUJOkf+nAEkiSASJIAIkkCiCQJIJIkAUSSBBBJEkAkSQCRJAFEkiSASJIAIkkCiCQJIJIkgEiSBBBJEkAkSQCRJAFEkgQQSZIAIkkCiCQJIJIkgEiSACJJEkAkSQCRJAFEkgQQSRJAJEkCiCQJIJIkgEiSACJJAkgt9X0/7vd71y/XMAyv/ZgfH2+9Xh6iQvcr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JAJEkCSCSJIBIkgAiSQKIJAkgkiQBRJIEEEkSQCRJAJEkAUSSJIBIkgAiSQKIJAkgkiSASJIEEEkSQCRJNfUD/Ye7UNZHtNkAAAAASUVORK5CYII="
36
+ }
gf/LightDiffusionFlow/install.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import launch
2
+ import os,sys
3
+
4
+
5
+ # if not launch.is_installed("js2py"):
6
+ # launch.run_pip("install js2py", "js2py")
gf/LightDiffusionFlow/javascript/state.app.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+
2
+ document.addEventListener('DOMContentLoaded', function() {
3
+ onUiLoaded(state.core.init);
4
+ });
gf/LightDiffusionFlow/javascript/state.constants.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ window.state = window.state || {};
2
+ state = window.state;
3
+
4
+ state.constants = {
5
+ LS_PREFIX: 'state-'
6
+ };
gf/LightDiffusionFlow/javascript/state.core.js ADDED
@@ -0,0 +1,1006 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.state = window.state || {};
2
+ state = window.state;
3
+
4
+
5
+ state.core = (function () {
6
+
7
+ const TABS = ['txt2img', 'img2img'];
8
+
9
+ // settingId, element
10
+ const ELEMENTS = {
11
+ 'prompt': 'prompt',
12
+ 'negative_prompt': 'neg_prompt',
13
+ 'sampling_steps': 'steps',
14
+ 'restore_faces': 'restore_faces',
15
+ 'tiling': 'tiling',
16
+ 'hires_fix': 'enable_hr',
17
+ 'hires_steps': 'hires_steps',
18
+ 'hires_scale': 'hr_scale',
19
+ 'hires_resize_x': 'hr_resize_x',
20
+ 'hires_resize_y': 'hr_resize_y',
21
+ 'hires_denoising_strength': 'denoising_strength',
22
+ 'width': 'width',
23
+ 'height': 'height',
24
+ 'batch_count': 'batch_count',
25
+ 'batch_size': 'batch_size',
26
+ 'cfg_scale': 'cfg_scale',
27
+ 'denoising_strength': 'denoising_strength',
28
+ 'seed': 'seed',
29
+ 'sampling': 'sampling',
30
+ 'switch_at': 'switch_at'
31
+ };
32
+
33
+ const ACCORDION = {
34
+ "hires_fix": "hr",
35
+ "refiner": "enable"
36
+ }
37
+
38
+ const ELEMENTS_WITHOUT_PREFIX = {
39
+ 'resize_mode': 'resize_mode',
40
+ 'setting_inpainting_mask_weight': 'setting_inpainting_mask_weight',
41
+ 'setting_CLIP_stop_at_last_layers': 'setting_CLIP_stop_at_last_layers',
42
+ 'setting_eta_noise_seed_delta': 'setting_eta_noise_seed_delta',
43
+ 'img2img_mask_blur': 'img2img_mask_blur',
44
+ 'img2img_mask_mode': 'img2img_mask_mode',
45
+ 'img2img_inpainting_fill': 'img2img_inpainting_fill',
46
+ 'img2img_inpaint_full_res_padding': 'img2img_inpaint_full_res_padding',
47
+ 'img2img_inpaint_full_res': 'img2img_inpaint_full_res',
48
+ 'img2img_mask_alpha': 'img2img_mask_alpha'
49
+ //'generation_info_txt2img': 'generation_info_txt2img' // 可能因为是visible=false 所以触发不了onchange事件?
50
+ };
51
+
52
+ const SELECTS = {
53
+ 'sampling': 'sampling',
54
+ 'hires_upscaler': 'hr_upscaler',
55
+ 'script': '#script_list',
56
+ 'checkpoint': 'checkpoint',
57
+ };
58
+
59
+ const SELECTS_WITHOUT_PREFIX = {
60
+ 'setting_sd_model_checkpoint': 'setting_sd_model_checkpoint',
61
+ 'setting_sd_vae': 'setting_sd_vae'
62
+ };
63
+
64
+ const MULTI_SELECTS = {
65
+ 'styles': 'styles'
66
+ };
67
+
68
+ const TOGGLE_BUTTONS = {
69
+ 'extra_networks': 'extra_networks',
70
+ };
71
+
72
+ var IMAGES_WITHOUT_PREFIX = {
73
+ };
74
+
75
+ const ELEMENTS_ALWAYS_SAVE = {
76
+ 'setting_sd_model_checkpoint': 'setting_sd_model_checkpoint',
77
+ };
78
+
79
+ const Image_extensions = [".png", ".jpg", ".jpeg"]
80
+
81
+ let store = null;
82
+ let timer = null;
83
+ let inited = false
84
+ let sd_versions = "0.0.0"
85
+ let waiting_second_apply = false
86
+ let timeout_id = undefined
87
+ let img_elem_keys=[];
88
+ let ext_list=[];
89
+ let flow_save_mode = "Core"
90
+
91
+
92
+ function hasSetting(id, tab) {
93
+ return true // 需要默认保存全部选项 不需要判断
94
+ const suffix = tab ? `_${tab}` : '';
95
+ return this[`state${suffix}`] && this[`state${suffix}`].indexOf(id) > -1;
96
+ }
97
+
98
+ function fn_timer(){
99
+
100
+ // if(inited){
101
+ fetch('/lightdiffusionflow/local/need_preload')
102
+ .then(response => response.json())
103
+ .then(data => {
104
+ console.log(`fn_timer`)
105
+ if (data != ""){
106
+ //state.core.actions.handleLightDiffusionFlow([{"name":data}]);
107
+ const btn1 = gradioApp().querySelector(`button#set_lightdiffusionflow_file`);
108
+ state.utils.triggerMouseEvent(btn1);
109
+ setTimeout(() => {
110
+ const btn2 = gradioApp().querySelector(`button#preload_button`);
111
+ state.utils.triggerMouseEvent(btn2);
112
+ }, 1000);
113
+ }
114
+ }).catch(function(e) {
115
+ clearInterval(timer)
116
+ console.log("Oops, error");
117
+ });
118
+ // }
119
+ // else{
120
+
121
+ // fetch('/lightdiffusionflow/local/get_imgs_elem_key') //初始化部分图片组件id, 后续设置onchanged事件
122
+ // .then(response => response.json())
123
+ // .then(data => {
124
+ // if(data != ""){
125
+
126
+ // img_elem_keys = data.split(",")
127
+ // img_elem_keys.forEach(key => {
128
+ // IMAGES_WITHOUT_PREFIX[key] = key
129
+ // });
130
+
131
+ // // 等上面的组件ID同步过来后 再加载其他配置
132
+ // fetch('/lightdiffusionflow/local/config.json?_=' + (+new Date()))
133
+ // .then(response => response.json())
134
+ // .then(config => {
135
+ // try {
136
+ // store = new state.Store();
137
+ // store.clearAll();
138
+ // load(config);
139
+ // inited = true
140
+ // } catch (error) {
141
+ // console.error('[state]: Error:', error);
142
+ // }
143
+ // })
144
+ // .catch(error => console.error('[state]: Error getting JSON file:', error));
145
+ // }
146
+ // });
147
+
148
+
149
+ // }
150
+
151
+ }
152
+
153
+ function get_js_local_data(){
154
+
155
+ if(state.utils.getCurSeed('txt2img') != undefined){
156
+ store.set(`txt2img_seed`,state.utils.getCurSeed('txt2img'))
157
+ }
158
+ if(state.utils.getCurSeed('img2img') != undefined){
159
+ store.set(`img2img_seed`,state.utils.getCurSeed('img2img'))
160
+ }
161
+
162
+ stored_config = store.getAll()
163
+
164
+ for (let key in stored_config){
165
+ if(key.indexOf("allow-preview") !== -1 && key.indexOf("ext-control-net") !== -1)
166
+ {
167
+ console.log("allow-preview改成false")
168
+ stored_config[key] = "false"
169
+ }
170
+ }
171
+
172
+ return stored_config
173
+ }
174
+
175
+ function get_imgs_elem_key(){
176
+
177
+ fetch('/lightdiffusionflow/local/get_imgs_elem_key') //初始化部分图片组件id, 后续设置onchanged事件
178
+ .then(response => response.json())
179
+ .then(data => {
180
+ console.log(data)
181
+ if(data == ''){
182
+ setTimeout(() => {
183
+ get_imgs_elem_key()
184
+ }, 500);
185
+ }
186
+ else{
187
+ img_elem_keys = data.split(",")
188
+ img_elem_keys.forEach(key => {
189
+ IMAGES_WITHOUT_PREFIX[key] = key
190
+ });
191
+
192
+ fetch('/lightdiffusionflow/local/get_ext_list')
193
+ .then(response => response.json())
194
+ .then(data => {
195
+ ext_list = data.split(",")
196
+ });
197
+
198
+ // 等上面的组件ID同步过来后 再加载其他配置
199
+ fetch('/lightdiffusionflow/local/config.json?_=' + (+new Date()))
200
+ .then(response => response.json())
201
+ .then(config => {
202
+ try {
203
+
204
+ try{
205
+ flow_save_mode = config['lightdiffusionflow-mode']
206
+ }catch (error) {
207
+ flow_save_mode = "Core"
208
+ }
209
+
210
+ store = new state.Store();
211
+ store.clearAll();
212
+ load(config);
213
+ timer = window.setInterval(fn_timer,1000); // 初始化页面完成后再启动timer读取文件
214
+ } catch (error) {
215
+ console.error('[state]: Error:', error);
216
+ }
217
+ })
218
+ .catch(error => console.error('[state]: Error getting JSON file:', error));
219
+ }
220
+ });
221
+
222
+ }
223
+
224
+ function init() {
225
+
226
+ //console.log(window.localization)
227
+ fetch('/lightdiffusionflow/local/refresh_ui') // 刷新页面触发python重置图片数据
228
+ .then(response => response.json())
229
+ .then(data => {
230
+ sd_versions = data
231
+ });
232
+
233
+ get_imgs_elem_key()
234
+
235
+ }
236
+
237
+ // function forEachImageElement(list, action) {
238
+ // for (const [settingId, element] of Object.entries(list)) {
239
+ // TABS.forEach(tab => {
240
+ // //if (config.hasSetting(settingId, tab)) {
241
+ // action(element, tab);
242
+ // //}
243
+ // });
244
+ // }
245
+ // }
246
+
247
+ function forEachElement_WithoutTabs(list, action) {
248
+ for (const [settingId, element] of Object.entries(list)) {
249
+ action(element);
250
+ }
251
+ }
252
+
253
+ function forEachElement(list, config, action) {
254
+ for (const [settingId, element] of Object.entries(list)) {
255
+ TABS.forEach(tab => {
256
+ if (config.hasSetting(settingId, tab)) {
257
+ action(element, tab);
258
+ }
259
+ });
260
+ }
261
+ }
262
+
263
+ function load(config, addEvtLsner=true) {
264
+ config.hasSetting = hasSetting
265
+
266
+ //loadUI(); // 往页面上添加按钮
267
+
268
+ for (let tab of TABS)
269
+ {
270
+ //console.log(`${tab}_script_container start`)
271
+ let script_container = getElement(`${tab}_script_container`)
272
+ state.utils.onFrameContentChange(script_container, function (el) {
273
+ clearTimeout(timeout_id);
274
+ timeout_id = setTimeout(() => {
275
+ if(waiting_second_apply)
276
+ {
277
+ waiting_second_apply = false
278
+ actions.applyState(false);
279
+ setTimeout(() => {
280
+ actions.preset_output_log("finished")
281
+ }, 3000);
282
+ }
283
+ }, 3000);
284
+ });
285
+ }
286
+
287
+ forEachElement(ACCORDION, config, (element, tab) => {
288
+ handleSavedAccordion(`${tab}_${element}`, addEvtLsner);
289
+ });
290
+
291
+ forEachElement_WithoutTabs(SELECTS_WITHOUT_PREFIX, (element) => {
292
+ handleSavedSelects(element, addEvtLsner);
293
+ });
294
+
295
+ forEachElement(ELEMENTS, config, (element, tab) => {
296
+ handleSavedInput(`${tab}_${element}`, addEvtLsner);
297
+ });
298
+
299
+ forEachElement_WithoutTabs(ELEMENTS_WITHOUT_PREFIX, (element) => {
300
+ handleSavedInput(element, addEvtLsner);
301
+ });
302
+
303
+ forEachElement(SELECTS, config, (element, tab) => {
304
+ handleSavedSelects(`${tab}_${element}`, addEvtLsner);
305
+ });
306
+
307
+ forEachElement(MULTI_SELECTS, config, (element, tab) => {
308
+ handleSavedMultiSelects(`${tab}_${element}`, addEvtLsner);
309
+ });
310
+
311
+ forEachElement(TOGGLE_BUTTONS, config, (element, tab) => {
312
+ handleToggleButton(`${tab}_${element}`, addEvtLsner);
313
+ });
314
+
315
+ forEachElement_WithoutTabs(IMAGES_WITHOUT_PREFIX, (element) => {
316
+ handleSavedImage(`${element}`, addEvtLsner);
317
+ });
318
+
319
+ handleExtensions(config, addEvtLsner);
320
+ //handleSettingsPage();
321
+
322
+ restoreTabs(config, addEvtLsner); // 恢复到最后点击的tab页面
323
+
324
+ forEachElement_WithoutTabs(ELEMENTS_ALWAYS_SAVE, (element) => {
325
+ state.utils.forceSaveSelect(getElement(element), element, store); //每次无论有没有修改都需要导出的选项
326
+ });
327
+ }
328
+
329
+ function createHeaderButton(title, text, className, style, action) {
330
+
331
+ const button = state.utils.html.create('button', {
332
+ title: title,
333
+ innerHTML: text,
334
+ className: className,
335
+ }, style);
336
+
337
+ if (action) {
338
+ button.addEventListener('click', action);
339
+ }
340
+
341
+ return button;
342
+ }
343
+
344
+ // function createHeaderFileInput(title, text, className) {
345
+
346
+ // let inputId = 'state-import-file-inline';
347
+
348
+ // let importBtn = createHeaderButton(title,text, className, {
349
+ // display: 'none'
350
+ // }, () => {
351
+ // actions.importState(inputId);
352
+ // });
353
+
354
+ // let label = state.utils.html.create('label', {}, { cursor: 'pointer' });
355
+ // label.appendChild(state.utils.html.create('input', {
356
+ // type: 'file',
357
+ // id: inputId,
358
+ // accept: 'application/json',
359
+ // }, {
360
+ // display: 'none'
361
+ // }));
362
+ // label.appendChild(document.createTextNode(text));
363
+ // label.addEventListener('change', () => {
364
+ // importBtn.dispatchEvent(new Event('click'));
365
+ // });
366
+
367
+ // let button = createHeaderButton(title, '', className, {});
368
+ // button.appendChild(label);
369
+
370
+ // return {
371
+ // hiddenButton: importBtn,
372
+ // button: button
373
+ // };
374
+ // }
375
+
376
+ // function loadUI() {
377
+ // let quickSettings = gradioApp().getElementById("quicksettings");
378
+ // let className = quickSettings.querySelector('button').className;
379
+ // quickSettings.appendChild(createHeaderButton('State: Reset', "*️⃣", className, {}, actions.resetAll));
380
+ // quickSettings.appendChild(createHeaderButton('State: Export',"📤", className, {}, actions.exportState));
381
+ // quickSettings.appendChild(createHeaderButton('State: test',"📤", className, {}, actions.test));
382
+ // let fileInput = createHeaderFileInput('State: Import',"📥", className);
383
+ // quickSettings.appendChild(fileInput.hiddenButton);
384
+ // quickSettings.appendChild(fileInput.button);
385
+ // }
386
+
387
+
388
+ function restoreTabs(config, addEvtLsner=true) {
389
+
390
+ if (! config.hasSetting('tabs')) {
391
+ return;
392
+ }
393
+
394
+ const tabs = gradioApp().querySelectorAll('#tabs > div:first-child button');
395
+ const value = store.get('tab');
396
+ if (value) {
397
+ for (var i = 0; i < tabs.length; i++) {
398
+ if (tabs[i].textContent === state.utils.getTranslation(value)) {
399
+ state.utils.triggerEvent(tabs[i], 'click');
400
+ break;
401
+ }
402
+ }
403
+ }
404
+
405
+ // Use this when onUiTabChange is fixed
406
+ // onUiTabChange(function () {
407
+ // store.set('tab', gradioApp().querySelector('#tabs .tab-nav button.selected').textContent);
408
+ // });
409
+ if(addEvtLsner){
410
+ bindTabClickEvents();
411
+ }
412
+ }
413
+
414
+ function bindTabClickEvents() {
415
+ Array.from(gradioApp().querySelectorAll('#tabs .tab-nav button')).forEach(tab => {
416
+ tab.removeEventListener('click', storeTab);
417
+ tab.addEventListener('click', storeTab);
418
+ });
419
+ }
420
+
421
+ function storeTab() {
422
+ let tab_name = gradioApp().querySelector('#tabs .tab-nav button.selected').textContent;
423
+ store.set('tab', state.utils.reverseTranslation(tab_name)[0]);
424
+ bindTabClickEvents(); // dirty hack here...
425
+ }
426
+
427
+ function getElement(id) {
428
+ for (let i = 0; i < TABS.length; i++) {
429
+ if (id.startsWith(`${TABS[i]}_#`)) {
430
+ // handle elements with same ids in different tabs...
431
+ return gradioApp().querySelector('#tab_' + id.replace(`${TABS[i]}_#`, `${TABS[i]} #`));
432
+ }
433
+ }
434
+ return gradioApp().getElementById(id);
435
+ }
436
+
437
+ function handleSavedInput(id, addEvtLsner=true) {
438
+
439
+ const elements = gradioApp().querySelectorAll(`#${id} textarea, #${id} input, #${id} img`);
440
+ const events = ['change', 'input'];
441
+
442
+ if (! elements || ! elements.length) {
443
+ return;
444
+ }
445
+
446
+ let forEach = function (action) {
447
+ events.forEach(function(event) {
448
+ elements.forEach(function (element) {
449
+ action.call(element, event);
450
+ });
451
+ });
452
+ };
453
+
454
+ if(addEvtLsner){
455
+ forEach(function (event) {
456
+ this.addEventListener(event, function () {
457
+ let value = this.value;
458
+ if (this.type && this.type === 'checkbox') {
459
+ value = this.checked;
460
+ }
461
+ else if (this.className === 'img') {
462
+ value = this.checked;
463
+ }
464
+ store.set(id, value);
465
+ });
466
+ });
467
+
468
+ TABS.forEach(tab => {
469
+ const seedInput = gradioApp().querySelector(`#${tab}_seed input`);
470
+ ['random_seed', 'reuse_seed'].forEach(id => {
471
+ const btn = gradioApp().querySelector(`#${tab}_${id}`);
472
+ btn.addEventListener('click', () => {
473
+ setTimeout(() => {
474
+ state.utils.triggerEvent(seedInput, 'change');
475
+ }, 100);
476
+ });
477
+ });
478
+ });
479
+ }
480
+
481
+ let value = store.get(id);
482
+ if (! value) {
483
+ return;
484
+ }
485
+ forEach(function (event) {
486
+ state.utils.setValue(this, value, event);
487
+ });
488
+ }
489
+
490
+ function handleSavedSelects(id, addEvtLsner=true) {
491
+ state.utils.handleSelect(getElement(id), id, store, force=false, addEvtLsner);
492
+ }
493
+
494
+ function handleSavedAccordion(id, addEvtLsner=true) {
495
+ state.utils.handleAccordion(getElement(id), id, store, addEvtLsner);
496
+ }
497
+
498
+ function handleSavedMultiSelects(id, addEvtLsner=true) {
499
+ const select = gradioApp().getElementById(`${id}`);
500
+ state.utils.handleMultipleSelect(select, id, store, addEvtLsner);
501
+ }
502
+
503
+ function handleSavedImage(id, addEvtLsner=true) {
504
+ state.utils.handleImage(getElement(id), id, store, addEvtLsner); // 图片有修改就发回到python保存
505
+ }
506
+
507
+ function handleToggleButton(id, addEvtLsner=true) {
508
+ const btn = gradioApp().querySelector(`button#${id}`);
509
+ if (! btn) { return; }
510
+ // legionfu
511
+ if (store.get(id) === 'true') {
512
+ state.utils.triggerMouseEvent(btn);
513
+ }
514
+ if(addEvtLsner){
515
+ btn.addEventListener('click', function () {
516
+ store.set(id, Array.from(this.classList).indexOf('secondary-down') === -1);
517
+ });
518
+ }
519
+ }
520
+
521
+ function handleExtensions(config, addEvtLsner=true) {
522
+ // if (config['state_extensions']) {
523
+ // config['state_extensions'].forEach(function (ext) {
524
+ // if (ext in state.extensions) {
525
+ // state.extensions[ext].init();
526
+ // }
527
+ // });
528
+ // }
529
+ for (const [name, obj] of Object.entries(state.extensions)) {
530
+ obj.init(flow_save_mode == "Core", addEvtLsner);
531
+ }
532
+
533
+ }
534
+
535
+ // function handleSettingsPage() { // settings state 界面 绑定按钮事件等操作
536
+
537
+ // const page = gradioApp().querySelector('#settings_state');
538
+ // state.utils.html.setStyle(page.querySelectorAll('fieldset'), {
539
+ // 'marginTop': '20px',
540
+ // 'marginBottom': '10px'
541
+ // });
542
+
543
+ // let buttonsContainer = gradioApp().querySelector('#settings_state_buttons');
544
+ // if (buttonsContainer) {
545
+ // buttonsContainer.parentNode.removeChild(buttonsContainer);
546
+ // }
547
+ // buttonsContainer = document.createElement('div');
548
+ // buttonsContainer.id = 'settings_state_buttons';
549
+
550
+ // let setCheckboxes = function (value, checkFunc) {
551
+ // checkFunc = checkFunc || function () { return true; };
552
+ // Array.from(page.querySelectorAll('input[type="checkbox"]')).forEach(function (el) {
553
+ // if (checkFunc(el)) {
554
+ // if (el.checked !== value) {
555
+ // el.checked = value;
556
+ // state.utils.triggerEvent(el, 'change');
557
+ // }
558
+ // } else if (el.checked === value) {
559
+ // el.checked = !value;
560
+ // state.utils.triggerEvent(el, 'change');
561
+ // }
562
+ // });
563
+ // };
564
+ // buttonsContainer.appendChild(state.utils.html.createButton('Select All', function () {
565
+ // setCheckboxes(true);
566
+ // }));
567
+ // buttonsContainer.appendChild(state.utils.html.createButton('Select All Except Seeds', function () {
568
+ // setCheckboxes(true, function (el) {
569
+ // return el.nextElementSibling.textContent.indexOf('seed') === -1;
570
+ // });
571
+ // }));
572
+ // buttonsContainer.appendChild(state.utils.html.createButton('Unselect All', function () {
573
+ // setCheckboxes(false);
574
+ // }));
575
+ // state.utils.html.setStyle(buttonsContainer, {
576
+ // 'marginTop': '20px',
577
+ // 'marginBottom': '10px'
578
+ // });
579
+ // buttonsContainer.appendChild(state.utils.html.create('hr'));
580
+ // buttonsContainer.appendChild(state.utils.html.create('div',
581
+ // { innerHTML: 'Actions' },
582
+ // { marginBottom: '10px' }));
583
+ // buttonsContainer.appendChild(state.utils.html.createButton('Reset All', actions.resetAll));
584
+ // buttonsContainer.appendChild(state.utils.html.createButton('Export State', actions.exportState));
585
+ // buttonsContainer.appendChild(state.utils.html.createButton('Import State', actions.importState));
586
+ // buttonsContainer.appendChild(state.utils.html.create('input', {
587
+ // id: 'state-import-file', type: 'file', accept: 'application/json'
588
+ // }));
589
+ // page.appendChild(buttonsContainer);
590
+ // }
591
+
592
+ let actions = {
593
+ // resetAll: function () {
594
+ // let confirmed = confirm('Reset all state values?');
595
+ // if (confirmed) {
596
+ // store.clearAll();
597
+ // alert('All state values deleted!');
598
+ // }
599
+ // },
600
+ applyState: async function (addEvtLsner=true) {
601
+ console.log("applyState")
602
+ await fetch('/lightdiffusionflow/local/config.json?_=' + (+new Date()))
603
+ .then(response => response.json())
604
+ .then(config => {
605
+ try {
606
+ config.hasSetting = hasSetting
607
+
608
+ try{
609
+ flow_save_mode = config['lightdiffusionflow-mode']
610
+ }catch (error) {
611
+ flow_save_mode = "Core"
612
+ }
613
+ //console.log(config)
614
+ //restoreTabs(config); // 恢复到最后点击的tab页面
615
+ load(config, addEvtLsner);
616
+ // forEachElement_WithoutTabs(SELECTS_WITHOUT_PREFIX, (element) => {
617
+ // handleSavedSelects(element);
618
+ // });
619
+
620
+ // forEachElement(ELEMENTS, config, (element, tab) => {
621
+ // handleSavedInput(`${tab}_${element}`);
622
+ // });
623
+
624
+ // forEachElement_WithoutTabs(ELEMENTS_WITHOUT_PREFIX, (element) => {
625
+ // handleSavedInput(element);
626
+ // });
627
+
628
+ // forEachElement(SELECTS, config, (element, tab) => {
629
+ // handleSavedSelects(`${tab}_${element}`);
630
+ // });
631
+
632
+ // forEachElement(MULTI_SELECTS, config, (element, tab) => {
633
+ // handleSavedMultiSelects(`${tab}_${element}`);
634
+ // });
635
+
636
+ // forEachElement(TOGGLE_BUTTONS, config, (element, tab) => {
637
+ // handleToggleButton(`${tab}_${element}`);
638
+ // });
639
+
640
+ // forEachElement_WithoutTabs(IMAGES_WITHOUT_PREFIX, (element) => {
641
+ // handleSavedImage(element);
642
+ // });
643
+
644
+ // handleExtensions(config);
645
+
646
+
647
+ //handleSettingsPage();
648
+ } catch (error) {
649
+ console.error('[state]: Error:', error);
650
+ }
651
+ })
652
+ .catch(error => console.error('[state]: Error getting JSON file:', error));
653
+ },
654
+
655
+ exportState: function () {
656
+
657
+ // if(state.utils.getCurSeed('txt2img') != undefined){
658
+ // store.set(`txt2img_seed`,state.utils.getCurSeed('txt2img'))
659
+ // }
660
+ // if(state.utils.getCurSeed('img2img') != undefined){
661
+ // store.set(`img2img_seed`,state.utils.getCurSeed('img2img'))
662
+ // }
663
+ let stored_config = get_js_local_data()
664
+
665
+ fetch('/lightdiffusionflow/local/lightdiffusionflow_config?data2export=true')
666
+ .then(response => response.json())
667
+ .then(config => {
668
+
669
+ config = JSON.parse(config)
670
+ //stored_config = store.getAll()
671
+
672
+ let data = {
673
+ method: 'POST',
674
+ headers: { 'Content-Type': 'application/json' },
675
+ body: JSON.stringify({
676
+ "config_data":stored_config
677
+ })
678
+ }
679
+ fetch(`/lightdiffusionflow/local/parse_lora_info`, data)
680
+ .then(response => response.json())
681
+ .then(response_lora_info => {
682
+
683
+ for (let key in response_lora_info){
684
+ stored_config[key] = response_lora_info[key]
685
+ }
686
+
687
+ for (let key in config){
688
+ if(config[key] != ""){
689
+ stored_config[key] = config[key]
690
+ }
691
+ }
692
+
693
+ // for (let key in stored_config){
694
+ // if(key.indexOf("allow-preview") !== -1 && key.indexOf("ext-control-net") !== -1)
695
+ // {
696
+ // console.log("allow-preview改成false")
697
+ // stored_config[key] = "false"
698
+ // }
699
+ // }
700
+
701
+ var checkTime = function (i) {
702
+ if (i < 10) { i = "0" + i; }
703
+ return i;
704
+ }
705
+ let nowdate = new Date();
706
+ let year = String(nowdate.getFullYear())
707
+ let month = String(checkTime(nowdate.getMonth() + 1))
708
+ let day = String(checkTime(nowdate.getDate()))
709
+ let h = String(checkTime(nowdate.getHours()))
710
+ let m = String(checkTime(nowdate.getMinutes()))
711
+ let s = String(checkTime(nowdate.getSeconds()))
712
+ let time_str = year+month+day+h+m+s
713
+
714
+ filename = 'flow-'+time_str+'.flow'
715
+ filename = prompt("Export workflow as:", filename);
716
+ if (!filename) return;
717
+ if (!filename.toLowerCase().endsWith(".flow")) {
718
+ filename += ".flow";
719
+ }
720
+ if(filename != ".flow"){
721
+ // const handle = window.showDirectoryPicker();
722
+ // console.log(handle)
723
+
724
+ state.utils.saveFile(filename, stored_config);
725
+
726
+ fetch('https://api.lightflow.ai/openapi/access?action=export')
727
+ .then(response => response.json())
728
+ .then(config => {
729
+ console.log(config)
730
+ }).catch(function(e) {
731
+ console.log("Oops, export callback error!");
732
+ });
733
+
734
+ }
735
+
736
+ }).catch(error => console.error('[state]: Error getting Flow file:', error));
737
+
738
+ }).catch(error => console.error('[state]: Error getting Flow file:', error));
739
+
740
+ //config = JSON.stringify(store.getAll(), null, 4);
741
+ //fetch(`/lightdiffusionflow/local/ExportLightDiffusionFlow?config=${config}`)
742
+ },
743
+ saveFlowToLocal: function saveFlowToLocal(){
744
+ var checkTime = function (i) {
745
+ if (i < 10) { i = "0" + i; }
746
+ return i;
747
+ }
748
+ let nowdate = new Date();
749
+ let year = String(nowdate.getFullYear())
750
+ let month = String(checkTime(nowdate.getMonth() + 1))
751
+ let day = String(checkTime(nowdate.getDate()))
752
+ let h = String(checkTime(nowdate.getHours()))
753
+ let m = String(checkTime(nowdate.getMinutes()))
754
+ let s = String(checkTime(nowdate.getSeconds()))
755
+ let time_str = year+month+day+h+m+s
756
+
757
+ filename = 'flow-'+time_str+'.flow'
758
+ filename = prompt("Save workflow as:", filename);
759
+ if (!filename) return;
760
+ if (!filename.toLowerCase().endsWith(".flow")) {
761
+ filename += ".flow";
762
+ }
763
+ if(filename != ".flow"){
764
+
765
+ let data = {
766
+ method: 'POST',
767
+ headers: { 'Content-Type': 'application/json' },
768
+ body: JSON.stringify({
769
+ "file_path":filename
770
+ })
771
+ }
772
+ fetch(`/lightdiffusionflow/local/file_exist`, data)
773
+ .then(response => response.json())
774
+ .then(data => {
775
+ if(!data || (data && confirm("Overwrite the existing file with the same name?")))
776
+ {
777
+ let stored_config = get_js_local_data()
778
+ let flow_data = {
779
+ method: 'POST',
780
+ headers: {'Content-Type': 'application/json'},
781
+ body: JSON.stringify({
782
+ "file_name":filename,
783
+ "file_data":stored_config,
784
+ "overwrite":true
785
+ })
786
+ }
787
+ fetch("/lightdiffusionflow/local/save_flow_to_local",flow_data)
788
+
789
+ fetch('https://api.lightflow.ai/openapi/access?action=save')
790
+ .then(response => response.json())
791
+ .then(config => {
792
+ console.log(config)
793
+ }).catch(function(e) {
794
+ console.log("Oops, export callback error!");
795
+ });
796
+ }
797
+ });
798
+ }
799
+ },
800
+
801
+ handleLightDiffusionFlow: function (fileInput){
802
+ actions.preset_output_log("start")
803
+ //actions.output_log("<hr style='margin-top:10px;margin-bottom:10px'>Start parsing settings...")
804
+ console.log(fileInput)
805
+ let temp_fileInput = undefined
806
+ try{temp_fileInput = fileInput[0]} catch(error){}
807
+ if ( !temp_fileInput ) {temp_fileInput = fileInput}
808
+ if ( !temp_fileInput ) {
809
+ //alert('Please select a JSON file!');
810
+ actions.preset_output_log("invalid")
811
+ //actions.output_log("Please select a valid lightdiffusionflow or image file!")
812
+ return;
813
+ }
814
+
815
+ let file_name = temp_fileInput.name;
816
+ console.log(file_name)
817
+ let extension = file_name.substring(file_name.lastIndexOf("."));
818
+ if( Image_extensions.indexOf(extension) != -1 ){
819
+ let data = {
820
+ method: 'POST',
821
+ headers: { 'Content-Type': 'application/json' },
822
+ body: JSON.stringify({
823
+ "img_path":file_name
824
+ })
825
+ }
826
+ fetch(`/lightdiffusionflow/local/png_info`, data)
827
+ .then(response => response.json())
828
+ .then(data => {
829
+ //console.log(data)
830
+ actions.importLightDiffusionFlow(data)
831
+ });
832
+ }
833
+ else{
834
+ // const file = new Blob([fileInput[0].name]);
835
+ const file = temp_fileInput.blob;
836
+ const reader = new FileReader();
837
+ reader.onload = function (event) {
838
+ actions.importLightDiffusionFlow(event.target.result)
839
+ };
840
+ try{ reader.readAsText(file); } catch (error) {
841
+ console.log("read from python")
842
+ if(temp_fileInput.name != ""){
843
+ let data = {
844
+ method: 'POST',
845
+ headers: { 'Content-Type': 'application/json' },
846
+ body: JSON.stringify({
847
+ "file_path":temp_fileInput.name
848
+ })
849
+ }
850
+ fetch(`/lightdiffusionflow/local/read_file`, data)
851
+ .then(response => response.json())
852
+ .then(data => {
853
+ actions.importLightDiffusionFlow(data)
854
+ });
855
+ }
856
+
857
+ }
858
+ }
859
+ return fileInput
860
+ },
861
+ importLightDiffusionFlow: function (inputData){
862
+
863
+ forEachElement_WithoutTabs(IMAGES_WITHOUT_PREFIX, (image_id) => {
864
+ state.utils.clearImage(getElement(image_id));
865
+ });
866
+
867
+ let json_obj = {}
868
+ try { json_obj = JSON.parse(inputData) } catch (error) {
869
+ actions.preset_output_log("invalid")
870
+ //actions.output_log("Please select a valid lightdiffusionflow or image file!")
871
+ return;
872
+ }
873
+
874
+ // 筛选掉默认值参数
875
+ let data = {
876
+ method: 'POST',
877
+ headers: { 'Content-Type': 'application/json' },
878
+ body: JSON.stringify({
879
+ "config_data":json_obj
880
+ })
881
+ }
882
+ fetch(`/lightdiffusionflow/local/useless_config_filter`, data)
883
+ .then(response => response.json())
884
+ .then(data => {
885
+ json_obj = data
886
+ console.log(ext_list)
887
+ // 缺少的插件
888
+ missing_ext_list = []
889
+ for (let key in json_obj){
890
+ ext_name = key.match(/ext-(\S+?)-(txt2img|img2img)/)
891
+ //console.log(key)
892
+ if(ext_name != null){
893
+ ext_name = ext_name[1]
894
+ //console.log(ext_name)
895
+ if(ext_list.indexOf(ext_name) === -1){
896
+ if(missing_ext_list.indexOf(ext_name) === -1){
897
+ missing_ext_list.push(ext_name)
898
+ }
899
+ }
900
+ }
901
+ }
902
+
903
+ if(missing_ext_list.length > 0){
904
+ actions.preset_output_log("missing_exts","",missing_ext_list.join(';'))
905
+ }
906
+
907
+ forEachElement_WithoutTabs(IMAGES_WITHOUT_PREFIX, (image_id) => {
908
+ json_obj[image_id] = ""
909
+ });
910
+ // webui主界面 没有localization相关的兼容问题 所以不用管
911
+
912
+ waiting_second_apply = true
913
+ store.clearAll();
914
+ store.load(json_obj);
915
+ actions.applyState();
916
+ });
917
+ return;
918
+ },
919
+ startImportImage: function (index){
920
+ index = Number(index)
921
+
922
+ //console.log(`-------startImportImage--'${index}'---------------`)
923
+ if(index+1 < img_elem_keys.length){
924
+ //console.log(`---------${img_elem_keys}---------------`)
925
+ //console.log(`---------'${index}'-----'${img_elem_keys.length}'-----------`)
926
+ switch_tab_dict = {
927
+ "img2img_invisible_img2img_image": "switch_to_img2img()",
928
+ "img2img_invisible_img2img_sketch": "switch_to_sketch()",
929
+ "img2img_invisible_img2maskimg": "switch_to_inpaint()",
930
+ "img2img_invisible_inpaint_sketch": "switch_to_inpaint_sketch()",
931
+ "img2img_invisible_img_inpaint_base": "state.utils.switch_to_img_inpaint()",
932
+ "img2img_invisible_img_inpaint_mask": "state.utils.switch_to_img_inpaint()",
933
+ "img2img_invisible_txt2img_controlnet_ControlNet_input_image": "state.utils.switch_to_txt2img_ControlNet(0)",
934
+ "img2img_invisible_img2img_controlnet_ControlNet_input_image": "state.utils.switch_to_img2img_ControlNet(0)"
935
+ }
936
+
937
+ for (let i = 0; i < 10; i++) {
938
+ switch_tab_dict[`img2img_invisible_txt2img_controlnet_ControlNet-${i}_input_image`] = `state.utils.switch_to_txt2img_ControlNet(${i})`
939
+ switch_tab_dict[`img2img_invisible_img2img_controlnet_ControlNet-${i}_input_image`] = `state.utils.switch_to_img2img_ControlNet(${i})`
940
+ }
941
+
942
+ state.utils.sleep(300).then(() => {
943
+ try{
944
+ key = "img2img_invisible_"+img_elem_keys[index+1]
945
+ eval( switch_tab_dict[key] ) // 跳转界面
946
+ const button = gradioApp().getElementById(key);
947
+ button.click();
948
+ } catch (error) {
949
+ console.warn('[startImportImage]: Error:', error);
950
+ if(index+1 < img_elem_keys.length){
951
+ // 图片组件设置出错了,但是需要继续后续的流程
952
+ index = img_elem_keys.length-1
953
+ }
954
+ }
955
+ });
956
+ }
957
+
958
+ switch(index+1 - img_elem_keys.length){
959
+ case 0:// 图片导入完成,开始导入Dropdown
960
+ state.utils.sleep(500).then(() => {
961
+ try{
962
+ const button = gradioApp().getElementById("lightdiffusionflow_set_dropdowns");
963
+ button.click();
964
+ } catch (error) {
965
+ console.warn('[set_dropdowns]: Error:', error);
966
+ }
967
+ });
968
+ break
969
+ // case 1:// 触发了导入Dropdown,现在导入其他参数会卡死,触发导入按钮,等下一轮正式开始导入
970
+ // state.utils.sleep(500).then(() => {
971
+ // const button = gradioApp().getElementById("lightdiffusionflow_set_js_params");
972
+ // console.log("lightdiffusionflow_set_js_params")
973
+ // button.click();
974
+ // });
975
+ // break
976
+ // case 2:// 导入其他参数
977
+ // state.utils.sleep(500).then(() => {
978
+ // console.log("导入其他参数")
979
+ // actions.applyState();
980
+ // });
981
+ // break
982
+ }
983
+ },
984
+ preset_output_log: function (preset, key="", value=""){
985
+ fetch(`/lightdiffusionflow/local/preset_output_log?preset=${preset}&key=${key}&value=${value}`).then(() => {
986
+ gradioApp().getElementById("img2img_invisible_refresh_log").click();
987
+ });
988
+ },
989
+ output_log: function (msg, msg_style=""){
990
+ fetch(`/lightdiffusionflow/local/output_log?msg=${msg}&style=${msg_style}`).then(() => {
991
+ gradioApp().getElementById("img2img_invisible_refresh_log").click();
992
+ });
993
+ },
994
+ output_warning: function (msg, msg_style="color:Orange;"){
995
+ actions.output_log(msg,msg_style)
996
+ },
997
+ output_error: function (msg, msg_style="color:Red;"){
998
+ actions.output_log(msg,msg_style)
999
+ },
1000
+ get_sd_version: function (){
1001
+ return sd_versions
1002
+ }
1003
+ };
1004
+
1005
+ return { init, actions };
1006
+ }());
gf/LightDiffusionFlow/javascript/state.ext.general.js ADDED
@@ -0,0 +1,501 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.state = window.state || {};
2
+ window.state.extensions = window.state.extensions || {};
3
+ state = window.state;
4
+
5
+ function general_ext(tab_name, extension_name, root_container) {
6
+
7
+ let container = root_container;
8
+ let store = null;
9
+ let cnTabs = [];
10
+ let root_not_tabs = null;
11
+ let cur_tab_name = tab_name;
12
+ let ext_name = extension_name
13
+ let LS_PREFIX = 'ext-'+ ext_name.replace(" ","-").toLowerCase() + "-"
14
+
15
+ function handleToggle(addEvtLsner=true) {
16
+ let value = store.get('toggled');
17
+ let toggleBtn = container.querySelector('div.cursor-pointer, .label-wrap');
18
+ //for(let toggleBtn of toggleBtns){
19
+ //if(!toggleBtn){continue}
20
+ if(toggleBtn && toggleBtn.className.split(' ').pop() != "open"){
21
+ if (value && value === 'true') {
22
+ state.utils.triggerEvent(toggleBtn, 'click');
23
+ //load();
24
+ }
25
+
26
+ if(addEvtLsner)
27
+ {
28
+ toggleBtn.addEventListener('click', function () {
29
+ let span = this.querySelector('.transition, .icon');
30
+ store.set('toggled', span.style.transform !== 'rotate(90deg)');
31
+ //load();
32
+ });
33
+ }
34
+ }
35
+ //}
36
+ }
37
+
38
+ function bindTabEvents(addEvtLsner=true) {
39
+ const tabs = container.querySelectorAll('.tabs > div > button');
40
+ if(addEvtLsner)
41
+ {
42
+ tabs.forEach(tab => { // dirty hack here
43
+ tab.removeEventListener('click', onTabClick);
44
+ tab.addEventListener('click', onTabClick);
45
+ });
46
+ }
47
+ return tabs;
48
+ }
49
+
50
+ function handleTabs(addEvtLsner=true) {
51
+ let tabs = bindTabEvents(addEvtLsner);
52
+ let value = store.get('tab');
53
+ if (value) {
54
+ for (var i = 0; i < tabs.length; i++) {
55
+ let translations = state.utils.reverseTranslation(tabs[i].textContent)
56
+ if (value in translations) {
57
+ //if (tabs[i].textContent === value) {
58
+ state.utils.triggerEvent(tabs[i], 'click');
59
+ break;
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ function onTabClick() {
66
+ store.set('tab', state.utils.reverseTranslation(this.textContent)[0]);
67
+ bindTabEvents();
68
+ }
69
+
70
+ function handleCheckbox(checkbox, store, addEvtLsner=true) {
71
+ let label = checkbox.nextElementSibling;
72
+ let translations = state.utils.reverseTranslation(label.textContent)
73
+ for (var text of translations){
74
+ var id = state.utils.txtToId(text);
75
+ var value = store.get(id);
76
+ if (value) {break}
77
+ }
78
+ if (value) {
79
+ state.utils.setValue(checkbox, value, 'change');
80
+ }
81
+
82
+ if(addEvtLsner){
83
+ checkbox.addEventListener('change', function () {
84
+ let label = checkbox.nextElementSibling;
85
+ let translations = state.utils.reverseTranslation(label.textContent)
86
+ for (var text of translations){
87
+ var id = state.utils.txtToId(text);
88
+ store.set(id, this.checked);
89
+ }
90
+ });
91
+ }
92
+ }
93
+ function handleCheckboxes(addEvtLsner=true) {
94
+ let root_checkboxes = root_not_tabs.container.querySelectorAll('input[type="checkbox"]');
95
+ root_checkboxes.forEach(function (root_checkbox) {
96
+ if(cnTabs.length == 0){
97
+ handleCheckbox(root_checkbox, root_not_tabs.store, addEvtLsner)
98
+ }
99
+ else{
100
+ let needsHandle = true
101
+ for(let tab of cnTabs){
102
+ if(tab.container.contains(root_checkbox)){
103
+ needsHandle = false
104
+ break
105
+ }
106
+ }
107
+ if(needsHandle){handleCheckbox(root_checkbox, root_not_tabs.store, addEvtLsner)}
108
+ } // else
109
+ });
110
+
111
+ cnTabs.forEach(({ container, store }) => {
112
+ let checkboxes = container.querySelectorAll('input[type="checkbox"]');
113
+ checkboxes.forEach(function (checkbox) {
114
+ handleCheckbox(checkbox, store, addEvtLsner)
115
+ });
116
+ });
117
+
118
+ }
119
+
120
+ function handleTextArea(textarea, index, store, addEvtLsner=true) {
121
+ var id = state.utils.txtToId(`textarea_${index}`);
122
+ var value = store.get(id);
123
+ if (value) {
124
+ state.utils.setValue(textarea, value, 'change');
125
+ }
126
+
127
+ if(addEvtLsner){
128
+ textarea.addEventListener('change', function () {
129
+ let text = this.value;
130
+ store.set(id, text);
131
+ //console.log(`id = ${id} value = ${text}`)
132
+ });
133
+ }
134
+ }
135
+ function handleTextAreas(addEvtLsner=true) {
136
+ let textArea_index = 0; // 因为文本框的顺序不会变,所以命名直接使用序号区分 "textarea_0"
137
+
138
+ let root_textareas = root_not_tabs.container.querySelectorAll('textarea');
139
+ root_textareas.forEach(function (root_textarea) {
140
+
141
+ if(cnTabs.length == 0){
142
+ handleTextArea(root_textarea, textArea_index, root_not_tabs.store, addEvtLsner)
143
+ textArea_index += 1
144
+ }
145
+ else{
146
+ let needsHandle = true
147
+ for(let tab of cnTabs){
148
+ if(tab.container.contains(root_textarea)){
149
+ needsHandle = false
150
+ break
151
+ }
152
+ }
153
+ if(needsHandle){
154
+ handleTextArea(root_textarea, textArea_index, root_not_tabs.store, addEvtLsner)
155
+ textArea_index += 1
156
+ }
157
+ } // else
158
+
159
+ });
160
+
161
+ cnTabs.forEach(({ container, store }) => {
162
+ container.querySelectorAll('textarea').forEach(textarea => {
163
+ handleTextArea(textarea, textArea_index, store, addEvtLsner)
164
+ textArea_index += 1
165
+ });
166
+ });
167
+
168
+ }
169
+
170
+ function handleSelect(select, store, addEvtLsner=true) {
171
+ let translations = state.utils.reverseTranslation(select.querySelector('label').firstChild.textContent)
172
+ for (var text of translations){
173
+ var id = state.utils.txtToId(text);
174
+ var value = store.get(id);
175
+ if (value) {break}
176
+ }
177
+ //id = state.utils.txtToId(translations[0]);
178
+ //if (value) { //前面不需要判断是否有值,因为需要执行handleSelect绑定onchange事件
179
+ state.utils.handleSelect(select, id, store, force=true, addEvtLsner);
180
+ //}
181
+
182
+ // let id = state.constants.LS_PREFIX+LS_PREFIX+"dropdown_"+index
183
+ // state.utils.onContentChange(select, function (el) {
184
+ // console.log(`onContentChange ${id}`)
185
+ // let selected = el.querySelector('span.single-select');
186
+ // if (selected) {
187
+ // store.setWithNoPrefix(id, selected.textContent);
188
+ // } else {
189
+ // // new gradio version...
190
+ // let input = el.querySelector('input');
191
+ // if (input) {
192
+ // store.setWithNoPrefix(id, input.value);
193
+ // }
194
+ // }
195
+ // });
196
+
197
+ if (id === 'preprocessor' && value && value.toLowerCase() !== 'none') {
198
+ state.utils.onNextUiUpdates(handleSliders); // update new sliders if needed
199
+ }
200
+ }
201
+ function handleSelects(addEvtLsner=true) {
202
+ // let root_selects = root_not_tabs.container.querySelectorAll('.gradio-dropdown');
203
+ // root_selects.forEach(function (root_select) {
204
+ // if(cnTabs.length == 0){
205
+ // handleSelect(root_select, global_dropdown_index[ext_name], root_not_tabs.store)
206
+ // global_dropdown_index[ext_name] += 1
207
+ // console.log(`global_dropdown_index = ${global_dropdown_index[ext_name]}`)
208
+ // }
209
+ // else{
210
+ // let needsHandle = true
211
+ // for(let tab of cnTabs){
212
+ // if(tab.container.contains(root_select)){
213
+ // needsHandle = false
214
+ // break
215
+ // }
216
+ // }
217
+ // if(needsHandle){
218
+ // handleSelect(root_select, global_dropdown_index[ext_name], root_not_tabs.store)
219
+ // global_dropdown_index[ext_name] += 1
220
+ // console.log(`global_dropdown_index = ${global_dropdown_index[ext_name]}`)
221
+ // }
222
+ // } // else
223
+ // });
224
+
225
+ // cnTabs.forEach(({ container, store }) => {
226
+ // container.querySelectorAll('.gradio-dropdown').forEach(select => {
227
+ // handleSelect(select, global_dropdown_index[ext_name], store)
228
+ // global_dropdown_index[ext_name] += 1
229
+ // console.log(`global_dropdown_index = ${global_dropdown_index[ext_name]}`)
230
+ // });
231
+ // });
232
+
233
+ let root_selects = root_not_tabs.container.querySelectorAll('.gradio-dropdown');
234
+ root_selects.forEach(function (root_select) {
235
+ if(cnTabs.length == 0){
236
+ handleSelect(root_select, root_not_tabs.store, addEvtLsner)
237
+ }
238
+ else{
239
+ let needsHandle = true
240
+ for(let tab of cnTabs){
241
+ if(tab.container.contains(root_select)){
242
+ needsHandle = false
243
+ break
244
+ }
245
+ }
246
+ if(needsHandle){handleSelect(root_select, root_not_tabs.store, addEvtLsner)}
247
+ } // else
248
+ });
249
+
250
+ cnTabs.forEach(({ container, store }) => {
251
+ container.querySelectorAll('.gradio-dropdown').forEach(select => {
252
+ handleSelect(select, store, addEvtLsner)
253
+ });
254
+ });
255
+
256
+ }
257
+
258
+ function handleSlider(slider, store, addEvtLsner=true) {
259
+ let label = slider.previousElementSibling.querySelector('label span');
260
+ let translations = state.utils.reverseTranslation(label.textContent)
261
+ for (var text of translations){
262
+ var id = state.utils.txtToId(text);
263
+ var value = store.get(id);
264
+ if (value) {break}
265
+ }
266
+ if (value) {
267
+ state.utils.setValue(slider, value, 'change');
268
+ }
269
+ if(addEvtLsner){
270
+ slider.addEventListener('change', function () {
271
+ //store.set(id, state.utils.reverseTranslation(this.value)[0]);
272
+ let label = slider.previousElementSibling.querySelector('label span');
273
+ let translations = state.utils.reverseTranslation(label.textContent)
274
+ for (var text of translations){
275
+ var id = state.utils.txtToId(text);
276
+ store.set(id, state.utils.reverseTranslation(this.value)[0]);
277
+ }
278
+ });
279
+ }
280
+ }
281
+ function handleSliders(addEvtLsner=true) {
282
+
283
+ let root_sliders = root_not_tabs.container.querySelectorAll('input[type="range"]');
284
+ root_sliders.forEach(function (root_slider) {
285
+ if(cnTabs.length == 0){
286
+ handleSlider(root_slider, root_not_tabs.store, addEvtLsner)
287
+ }
288
+ else{
289
+ let needsHandle = true
290
+ for(let tab of cnTabs){
291
+ if(tab.container.contains(root_slider)){
292
+ needsHandle = false
293
+ break
294
+ }
295
+ }
296
+ if(needsHandle){handleSlider(root_slider, root_not_tabs.store, addEvtLsner)}
297
+ } // else
298
+ });
299
+
300
+ cnTabs.forEach(({ container, store }) => {
301
+ let sliders = container.querySelectorAll('input[type="range"]');
302
+ sliders.forEach(function (slider) {
303
+ handleSlider(slider, store, addEvtLsner)
304
+ });
305
+ });
306
+ }
307
+
308
+ function handleRadioButton(fieldset, store, addEvtLsner=true) {
309
+ let label = fieldset.firstChild.nextElementSibling;
310
+ let radios = fieldset.querySelectorAll('input[type="radio"]');
311
+ let translations = state.utils.reverseTranslation(label.textContent)
312
+ for (var text of translations){
313
+ var id = state.utils.txtToId(text);
314
+ var value = store.get(id);
315
+ if (value) {break}
316
+ }
317
+ if (value) {
318
+ radios.forEach(function (radio) {
319
+ state.utils.setValue(radio, value, 'change');
320
+ });
321
+ }
322
+
323
+ if(addEvtLsner){
324
+ radios.forEach(function (radio) {
325
+ radio.addEventListener('change', function () {
326
+ let label = fieldset.firstChild.nextElementSibling;
327
+ let translations = state.utils.reverseTranslation(label.textContent)
328
+ for (var text of translations){
329
+ var id = state.utils.txtToId(text);
330
+ store.set(id, state.utils.reverseTranslation(this.value)[0]);
331
+ }
332
+ });
333
+ });
334
+ }
335
+ }
336
+ function handleRadioButtons(addEvtLsner=true) {
337
+
338
+ let root_fieldsets = root_not_tabs.container.querySelectorAll('fieldset');
339
+ root_fieldsets.forEach(function (root_fieldset) {
340
+ if(cnTabs.length == 0){
341
+ handleRadioButton(root_fieldset, root_not_tabs.store, addEvtLsner)
342
+ }
343
+ else{
344
+ let needsHandle = true
345
+ for(let tab of cnTabs){
346
+ if(tab.container.contains(root_fieldset)){
347
+ needsHandle = false
348
+ break
349
+ }
350
+ }
351
+ if(needsHandle){handleRadioButton(root_fieldset, root_not_tabs.store, addEvtLsner)}
352
+ } // else
353
+ });
354
+
355
+ cnTabs.forEach(({ container, store }) => {
356
+ let fieldsets = container.querySelectorAll('fieldset');
357
+ fieldsets.forEach(function (fieldset) {
358
+ handleRadioButton(fieldset, store, addEvtLsner)
359
+ });
360
+ });
361
+ }
362
+
363
+
364
+ function load(addEvtLsner=true) {
365
+ setTimeout(function () {
366
+ handleTabs(addEvtLsner);
367
+ handleCheckboxes(addEvtLsner);
368
+ handleTextAreas(addEvtLsner);
369
+ if(state.utils.target_is_newer_version(state.core.actions.get_sd_version(), "v1.6.0")){
370
+ //console.log("-----------general handleSelects-------")
371
+ handleSelects(addEvtLsner);
372
+ }
373
+ handleSliders(addEvtLsner);
374
+ handleRadioButtons(addEvtLsner);
375
+ }, 500);
376
+ }
377
+
378
+ function init(addEvtLsner=true) {
379
+
380
+ store = new state.Store(LS_PREFIX + cur_tab_name);
381
+
382
+ if (! container) {
383
+ return;
384
+ }
385
+
386
+ let tabnav = container.getElementsByClassName('tabs');
387
+ let tabs = []
388
+ if(tabnav.length > 0 ){
389
+ tabs = Array.from(tabnav[0].childNodes).filter(item => item.className && item.className.indexOf("tabitem") !== -1)
390
+ }
391
+
392
+ cnTabs = [];
393
+ if (tabs.length) {
394
+ tabs.forEach((tabContainer, i) => {
395
+ cnTabs.push({
396
+ container: tabContainer,
397
+ store: new state.Store(LS_PREFIX + cur_tab_name + "_" + i)
398
+ });
399
+ });
400
+ }
401
+ //else {
402
+ root_not_tabs = {
403
+ container: container,
404
+ store: new state.Store(LS_PREFIX + cur_tab_name)
405
+ }
406
+ //}
407
+
408
+ handleToggle(addEvtLsner);
409
+ load(addEvtLsner);
410
+ }
411
+ return { init,LS_PREFIX };
412
+ }
413
+
414
+
415
+ function general_ext_main(tab){
416
+
417
+ let cur_tab_name = tab
418
+ let general_ext_list = []
419
+ // 遍历第一级子节点 每个节点选出一个层级最小且innerText不为空的子节点
420
+ function walks_element(element, cur_gen){
421
+ if(element.innerText != "" && element.innerText != undefined && element.children.length == 0){
422
+ return [[element.innerText,cur_gen]]
423
+ }
424
+ let res = []
425
+ for(child of element.children){
426
+ res = res.concat(walks_element(child,cur_gen+1,res))
427
+ }
428
+
429
+ return res
430
+ }
431
+
432
+ function init(core_mode = true, addEvtLsner=true) {
433
+ console.log(`------------${cur_tab_name}----init--- addEvtLsner=${addEvtLsner} ----`)
434
+
435
+ if(addEvtLsner==false)
436
+ {
437
+ for (let obj of general_ext_list)
438
+ {
439
+ obj.init(addEvtLsner);
440
+ }
441
+ return
442
+ }
443
+
444
+ let container = gradioApp().getElementById(cur_tab_name+'_script_container'); // main container
445
+
446
+ let extensions_root = container.children
447
+ if(extensions_root.length > 0 && extensions_root[0].className.split(' ')[0] != "gr-group" && extensions_root[0].className.split(' ')[0] != "gradio-group"){
448
+ extensions_root = extensions_root[0].children // webui v1.6.0 版本,UI结构有变更
449
+ }
450
+ //console.log(extensions_root)
451
+ for (child of extensions_root){
452
+ let root_container = child
453
+ res = walks_element(child, 0)
454
+ let min_gen = 99
455
+ let title = undefined
456
+ for(pair of res){
457
+ if(pair[1] < min_gen){
458
+ min_gen = pair[1]
459
+ title = pair[0]
460
+ }
461
+ }
462
+
463
+ if(title == undefined
464
+ || title.toLowerCase() == "lightdiffusionflow" // 自己存自己就不用了
465
+ ){continue}
466
+
467
+ let translations = state.utils.reverseTranslation(title)
468
+ title = translations[0] // 标题翻译一般只会有一个?
469
+ if(title.toLowerCase() == 'script'){break} // script后面的面板暂时不考虑
470
+ console.log(title)
471
+
472
+ reg = /(.+) v[0-9\.]+/
473
+ if(reg.test(title)){title = RegExp.$1} // 匹配 xxx v0.0.0 格式的标题,把后半部分的版本号去掉
474
+
475
+ if(title == "ControlNet"){title = "Control Net"} // 兼容旧命名
476
+ else{
477
+ if(core_mode){continue}
478
+ }
479
+
480
+ let ext_name = title.replace(" ","-").toLowerCase()
481
+ console.log(ext_name)
482
+
483
+ // if(!global_dropdown_index[ext_name]){
484
+ // global_dropdown_index[ext_name] = 0
485
+ // }
486
+ general_ext_obj = general_ext(cur_tab_name, ext_name, root_container)
487
+ general_ext_list.push(general_ext_obj)
488
+ general_ext_obj.init(addEvtLsner);
489
+ }
490
+
491
+ }
492
+ return {init}
493
+ }
494
+
495
+ //global_dropdown_index = {} // py里是不分txt2img和img2img的,但是这里是需要区分的。。
496
+
497
+ const TABS = ['txt2img', 'img2img'];
498
+ for (tab of TABS){
499
+ state.extensions[`${tab}-ext-general`] = general_ext_main(tab);
500
+ }
501
+
gf/LightDiffusionFlow/javascript/state.store.js ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.state = window.state || {};
2
+ state = window.state;
3
+
4
+ state.Store = function Store (prefix) {
5
+ this.prefix = state.constants.LS_PREFIX + (prefix ? prefix + '-' : '');
6
+ }
7
+
8
+ state.Store.prototype.setWithNoPrefix = function (key, value) {
9
+ localStorage.setItem(key, value);
10
+ };
11
+
12
+ state.Store.prototype.set = function (key, value) {
13
+ if (key.startsWith(this.prefix)) {
14
+ localStorage.setItem(key, value);
15
+ } else {
16
+ localStorage.setItem(this.prefix + key, value);
17
+ }
18
+ };
19
+
20
+ state.Store.prototype.get = function (key) {
21
+ return localStorage.getItem(this.prefix + key);
22
+ };
23
+
24
+ state.Store.prototype.remove = function (key) {
25
+ localStorage.removeItem(this.prefix + key);
26
+ };
27
+
28
+ state.Store.prototype.clear = function () {
29
+ localStorage.clear();
30
+ };
31
+
32
+ state.Store.prototype.clearAll = function () {
33
+ let keys = Object.keys(localStorage);
34
+ for (let i = 0; i < keys.length; i++) {
35
+ if (keys[i].startsWith(state.constants.LS_PREFIX)) {
36
+ localStorage.removeItem(keys[i]);
37
+ }
38
+ }
39
+ };
40
+
41
+ state.Store.prototype.getAll = function () {
42
+ let result = {};
43
+ let keys = Object.keys(localStorage);
44
+ for (let i = 0; i < keys.length; i++) {
45
+ if (keys[i].startsWith(state.constants.LS_PREFIX)) {
46
+ result[keys[i]] = localStorage[keys[i]];
47
+ }
48
+ }
49
+ return result;
50
+ };
51
+
52
+ state.Store.prototype.load = function (json) {
53
+ this.clearAll();
54
+ let keys = Object.keys(json);
55
+ for (let i = 0; i < keys.length; i++) {
56
+ if (keys[i].startsWith(state.constants.LS_PREFIX)) {
57
+ this.set(keys[i], json[keys[i]]);
58
+ }
59
+ }
60
+ };
gf/LightDiffusionFlow/javascript/state.utils.js ADDED
@@ -0,0 +1,684 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.state = window.state || {};
2
+ state = window.state;
3
+ let selectingQueue = 0; // 默认都延时一下再开始触发
4
+
5
+ state.utils = {
6
+
7
+ testFunction: function testFunction() {
8
+ //console.log(state.extensions)
9
+ // const button = gradioApp().getElementById("lightdiffusionflow_set_elements");
10
+ // button.click();
11
+ value = "新建文件夹\\anything-v5-PrtRE.safetensors"
12
+ value = value.replace("/","\\")
13
+ parts = value.split("\\")
14
+ console.log(parts[parts.length - 1])
15
+ },
16
+
17
+ target_is_newer_version: function(cur_version, target_version){
18
+
19
+ let cur = cur_version.replace("v","")
20
+ cur = cur.split(".")
21
+
22
+ let target = target_version.replace("v","")
23
+ target = target.split(".")
24
+ let version_len = Math.min(cur.length, target.length)
25
+
26
+ // 逐个版本号比较 v1.2.3 和 v1.2比较时,只比较前面两个数字
27
+ for (let i=0; i < version_len; i++){
28
+ if(Number(cur[i]) > Number(target[i])){
29
+ return false
30
+ }
31
+ else if(Number(cur[i]) < Number(target[i])){
32
+ return true
33
+ }
34
+ }
35
+
36
+ // 前面的版本号一样,再看谁的版本号更长
37
+ if(cur.length >= target.length){
38
+ return false
39
+ }
40
+
41
+ return true
42
+ },
43
+
44
+ searchCheckPointByHash: async function searchCheckPointByHash(hash){
45
+ let downloadUrl = undefined
46
+ hash_str = hash.replace("[","").replace("]","").replace(/^\s+|\s+$/g,"")
47
+ await fetch("https://civitai.com/api/v1/model-versions/by-hash/"+hash_str)
48
+ .then(response => response.json())
49
+ .then(data => {
50
+ //try{
51
+ //console.log(data["files"])
52
+ for (file of data["files"]){
53
+ for (key of Object.keys(file["hashes"])){
54
+ if(file["hashes"][key].toLowerCase() === hash_str.toLowerCase())
55
+ {
56
+ downloadUrl = file["downloadUrl"]
57
+ console.log(downloadUrl)
58
+ break
59
+ }
60
+ }
61
+ }
62
+ if(downloadUrl == undefined){downloadUrl = data["files"][0]["downloadUrl"]}
63
+ //} catch (error) {}
64
+ }).catch(function(e) {
65
+ console.log("search model error!");
66
+ });
67
+
68
+ return downloadUrl
69
+ },
70
+
71
+ getTranslation: function getTranslation(key){
72
+ new_key = key
73
+ try{
74
+ if(window.localization[new_key.replace(/^\s+|\s+$/g,"")] != undefined){
75
+ new_key = window.localization[new_key]
76
+ }
77
+ } catch (error) {
78
+ console.warn('getTranslation error:', error);
79
+ }
80
+ return new_key
81
+ },
82
+
83
+ reverseTranslation: function reverseTranslation(key){
84
+ new_key = []
85
+ try{
86
+ //key=key.replace(/^\s+|\s+$/g,"");
87
+ for (localize_key of Object.keys(window.localization)) {
88
+ if(key.replace(/^\s+|\s+$/g,"") === window.localization[localize_key].replace(/^\s+|\s+$/g,"")){
89
+ tmp_key = localize_key
90
+ new_key.push(tmp_key)
91
+ //break
92
+ }
93
+ }
94
+ } catch (error) {
95
+ console.warn('reverseTranslation error:', error);
96
+ }
97
+
98
+ if(new_key.length == 0){new_key.push(key)}
99
+ //console.log(`---------reverseTranslation---------${key}---------`)
100
+ //console.log(new_key)
101
+ return new_key
102
+ },
103
+
104
+ sleep: function sleep(time) {
105
+ return new Promise((resolve) => setTimeout(resolve, time));
106
+ },
107
+
108
+ switch_to_img_inpaint: function switch_to_img_inpaint() {
109
+ switch_to_img2img_tab(4);
110
+ return Array.from(arguments);
111
+ },
112
+ switch_to_txt2img_ControlNet: function switch_to_txt2img_ControlNet(unit) {
113
+
114
+ switch_to_txt2img()
115
+
116
+ let elem = undefined
117
+ elem = gradioApp().getElementById('txt2img_controlnet')
118
+ elem = elem.querySelector("#controlnet")
119
+
120
+ try{
121
+ if(elem.className.split(' ').pop() != "open"){
122
+ state.utils.triggerMouseEvent(elem, 'click')
123
+ }
124
+ for(e of elem.children){
125
+ if(e.className.split(' ').pop() != "open"){
126
+ state.utils.triggerMouseEvent(e, 'click')
127
+ }
128
+ }
129
+ } catch(error){console.log(error)}
130
+
131
+ try{
132
+ gradioApp().getElementById('txt2img_controlnet_tabs').querySelectorAll('button')[Number(unit)].click()
133
+ } catch (error) {
134
+ console.warn('[switch_to_txt2img_ControlNet]: Error:', error);
135
+ }
136
+ },
137
+ switch_to_img2img_ControlNet: function switch_to_img2img_ControlNet(unit) {
138
+
139
+ switch_to_img2img()
140
+
141
+ let elem = undefined //gradioApp().getElementById('txt2img_controlnet').children[0].children[1]
142
+ elem = gradioApp().getElementById('img2img_controlnet')
143
+ elem = elem.querySelector("#controlnet")
144
+
145
+ try{
146
+ if(elem.className.split(' ').pop() != "open"){
147
+ state.utils.triggerMouseEvent(elem, 'click')
148
+ }
149
+ for(e of elem.children){
150
+ if(e.className.split(' ').pop() != "open"){
151
+ state.utils.triggerMouseEvent(e, 'click')
152
+ }
153
+ }
154
+ } catch(error){console.log(error)}
155
+
156
+ try{
157
+ gradioApp().getElementById('img2img_controlnet_tabs').querySelectorAll('button')[Number(unit)].click()
158
+ } catch (error) {
159
+ console.warn('[switch_to_img2img_ControlNet]: Error:', error);
160
+ }
161
+ },
162
+ triggerEvent: function triggerEvent(element, event) {
163
+ if (! element) {
164
+ return;
165
+ }
166
+ element.dispatchEvent(new Event(event.trim()));
167
+ return element;
168
+ },
169
+ triggerMouseEvent: function triggerMouseEvent(element, event) {
170
+ if (! element) {
171
+ return;
172
+ }
173
+ event = event || 'click';
174
+ element.dispatchEvent(new MouseEvent(event, {
175
+ view: window,
176
+ bubbles: true,
177
+ cancelable: true,
178
+ }));
179
+ return element;
180
+ },
181
+ setValue: function setValue(element, value, event) {
182
+ switch (element.type) {
183
+ case 'checkbox':
184
+ element.checked = value === 'true';
185
+ this.triggerEvent(element, event);
186
+ break;
187
+ case 'radio':
188
+ if (element.value === value) {
189
+ element.checked = true;
190
+ this.triggerEvent(element, event);
191
+ }
192
+ else if(element.value == "Scribble/Sketch" && value == "Scribble"){
193
+ element.checked = true;
194
+ this.triggerEvent(element, event);
195
+ }
196
+ else {
197
+ element.checked = false;
198
+ }
199
+ break;
200
+ default:
201
+ element.value = value;
202
+ this.triggerEvent(element, event);
203
+ }
204
+ },
205
+ onFrameContentChange: function onFrameContentChange(targetNode, func) {
206
+ if(targetNode) {
207
+ const observer = new MutationObserver((mutationsList, observer) => {
208
+ for (const mutation of mutationsList) {
209
+ if (mutation.type === 'childList' ||
210
+ (mutation.type === 'attributes' && mutation.attributeName == 'src') // 图片被更改
211
+ ) {
212
+ //console.log(`onFrameContentChange ${mutation.type} `)
213
+ func(targetNode);
214
+ }
215
+ }
216
+ });
217
+ observer.observe(targetNode, {
218
+ //attributes: true,
219
+ childList: true,
220
+ //characterData: true,
221
+ subtree: true
222
+ });
223
+ }
224
+ },
225
+
226
+ onContentChange: function onContentChange(targetNode, func) {
227
+ if(targetNode) {
228
+ const observer = new MutationObserver((mutationsList, observer) => {
229
+ for (const mutation of mutationsList) {
230
+ if (mutation.type === 'childList' ||
231
+ (mutation.type === 'attributes' && mutation.attributeName == 'src') // 图片被更改
232
+ ) {
233
+ func(targetNode);
234
+ }
235
+ }
236
+ });
237
+ observer.observe(targetNode, {
238
+ attributes: true,
239
+ childList: true,
240
+ characterData: true,
241
+ subtree: true
242
+ });
243
+ }
244
+ },
245
+
246
+ onAccordionChange: function onAccordionChange(targetNode, func) {
247
+ if(targetNode) {
248
+ const observer = new MutationObserver((mutationsList, observer) => {
249
+ for (const mutation of mutationsList) {
250
+ if (mutation.type === 'attributes' ) {
251
+ func(targetNode);
252
+ }
253
+ }
254
+ });
255
+ observer.observe(targetNode, {
256
+ attributes: true,
257
+ });
258
+ }
259
+ },
260
+
261
+ getCurSeed: function getCurSeed(tab) {
262
+ const elements = gradioApp().getElementById(`html_info_${tab}`).querySelectorAll(`#html_info_${tab}`);
263
+ if (! elements || ! elements.length || !elements[0].innerText) {
264
+ return undefined;
265
+ }
266
+ seed = undefined
267
+ values = elements[0].innerText.split(',')
268
+ for (value of values){
269
+ pair = value.split(':')
270
+ if(pair[0].replace(/^\s+|\s+$/g,"") == 'Seed'){
271
+ seed = pair[1].replace(/^\s+|\s+$/g,"")
272
+ }
273
+ }
274
+ return seed
275
+ },
276
+
277
+ handleImage: function handleImage(select, id, store, addEvtLsner=true) {
278
+ if(addEvtLsner){
279
+ setTimeout(() => {
280
+ state.utils.onContentChange(select, function (el) {
281
+
282
+ let data = {
283
+ method: 'POST',
284
+ headers: { 'Content-Type': 'application/json' },
285
+ body: JSON.stringify({
286
+ "id":id,
287
+ "img":""
288
+ })
289
+ }
290
+
291
+ try {
292
+ // new gradio version...
293
+ let img = el.querySelector('img');
294
+ if (img) {
295
+ data.body = JSON.stringify({
296
+ "id":id,
297
+ "img":img.src
298
+ })
299
+ }
300
+ } catch (error) {
301
+ console.warn('[state]: Error:', error);
302
+ }
303
+ //console.log(`image changed ${id}`)
304
+ fetch(`/lightdiffusionflow/local/imgs_callback`, data)
305
+ });
306
+ }, 150);
307
+ }
308
+ },
309
+
310
+ clearImage: function clearImage(select) {
311
+ try {
312
+ if(select){
313
+
314
+ let buttons = select.querySelectorAll('button');
315
+ buttons.forEach(button => {
316
+ if(button.getAttribute("aria-label") == "Clear"){
317
+ button.click();
318
+ //state.utils.triggerMouseEvent(button, 'mousedown');
319
+ }
320
+ });
321
+
322
+ }
323
+ } catch (error) {
324
+ console.warn('[state]: Error:', error);
325
+ }
326
+ },
327
+ // handleSelect: function handleSelect(select, id, store) {
328
+ // try {
329
+ // let value = store.get(id);
330
+ // if (value) {
331
+
332
+ // let input = select.querySelector('input');
333
+ // state.utils.triggerMouseEvent(input, 'focus');
334
+
335
+ // setTimeout(() => {
336
+ // let items = Array.from(select.querySelectorAll('ul li'));
337
+ // for (li of items){
338
+ // if (li.lastChild.wholeText.trim() === value) {
339
+ // state.utils.triggerMouseEvent(li, 'mousedown');
340
+ // //return false;
341
+ // break
342
+ // }
343
+ // }
344
+ // state.utils.triggerMouseEvent(input, 'blur');
345
+ // }, 100);
346
+ // }
347
+
348
+ // setTimeout(() => {
349
+ // state.utils.onContentChange(select, function (el) {
350
+ // let selected = el.querySelector('span.single-select');
351
+ // if (selected) {
352
+ // store.set(id, selected.textContent);
353
+ // } else {
354
+ // // new gradio version...
355
+ // let input = select.querySelector('input');
356
+ // if (input) {
357
+ // store.set(id, input.value);
358
+ // }
359
+ // }
360
+ // });
361
+ // }, 150);
362
+ // } catch (error) {
363
+ // console.warn('[state]: Error:', error);
364
+ // }
365
+ // },
366
+
367
+ forceSaveSelect: function forceSaveSelect(select, id, store) {
368
+ let selected = select.querySelector('span.single-select');
369
+ if (selected) {
370
+ store.set(id, selected.textContent);
371
+ } else {
372
+ // new gradio version...
373
+ let input = select.querySelector('input');
374
+ if (input) {
375
+ store.set(id, input.value);
376
+ }
377
+ }
378
+ },
379
+ handleAccordion: function handleAccordion(accordion, id, store, addEvtLsner=true){
380
+ try{
381
+ let value = store.get(id);
382
+ let child = accordion.querySelector('div.cursor-pointer, .label-wrap');
383
+ if (value) {
384
+ //for(child of children){
385
+ //let span = child.querySelector('.transition, .icon');
386
+ //if(span.style.transform !== 'rotate(90deg)'){
387
+ if(child.className.split(' ').pop() != "open"){
388
+ state.utils.triggerMouseEvent(child, 'click')
389
+ }
390
+ //}
391
+ }
392
+
393
+ if(addEvtLsner){
394
+ setTimeout(() => {
395
+ state.utils.onAccordionChange(child, function (el) {
396
+ store.set(id, el.className.split(' ').pop() == "open");
397
+ //console.log(`accordion on change ${id}`)
398
+ //let span = el.querySelector('.transition, .icon');
399
+ //store.set(id, span.style.transform !== 'rotate(90deg)');
400
+ });
401
+ }, 150);
402
+ }
403
+ } catch (error) {
404
+ console.warn(`accordion:${accordion}, id:${id}`)
405
+ console.warn('[state]: Error:', error);
406
+ }
407
+ },
408
+ handleSelect: function handleSelect(select, id, store, force=false, addEvtLsner=true) {
409
+ try {
410
+
411
+ let value = store.get(id);
412
+ if ( value ) { //&& value != 'None'
413
+ value = value.replace("/","\\")
414
+ let parts = value.split("\\")
415
+ value = parts[parts.length - 1]
416
+
417
+ selectingQueue += 1;
418
+ setTimeout(() => {
419
+
420
+ let input = select.querySelector('input');
421
+ state.utils.triggerMouseEvent(input, 'focus');
422
+ setTimeout(() => {
423
+ let items = Array.from(select.querySelectorAll('ul li'));
424
+ let localized_value = this.getTranslation(value)
425
+ let successed = false
426
+ for (li of items){
427
+ // li.lastChild.wholeText.trim() === value
428
+ let option = li.lastChild.wholeText.trim().replace(/^\s+|\s+$/g,"")
429
+ option = option.replace("/","\\")
430
+ let parts = option.split("\\")
431
+ option = parts[parts.length - 1]
432
+ if (localized_value.replace(/^\s+|\s+$/g,"") === option) {
433
+ state.utils.triggerMouseEvent(li, 'mousedown');
434
+ successed = true
435
+ break
436
+ }
437
+ }
438
+
439
+ let hash_res = localized_value.match(/\[[0-9A-Fa-f]{8,10}\]/)
440
+ if(!successed){ // && hash_pos != -1 找不到对应选项 并且选项里有10位哈希值
441
+ for (li of items){
442
+
443
+ // 去掉Hash比较
444
+ let text = li.lastChild.wholeText.trim()
445
+ text = text.replace("/","\\")
446
+ let parts = text.split("\\")
447
+ text = parts[parts.length - 1]
448
+
449
+ let localized_value_no_hash = localized_value.replace(/\[[0-9A-Fa-f]{8,10}\]/,"").replace(/^\s+|\s+$/g,"")
450
+ let text_no_hash = text.replace(/\[[0-9A-Fa-f]{8,10}\]/, "").replace(/^\s+|\s+$/g,"")
451
+
452
+ if (localized_value_no_hash === text_no_hash) {
453
+ successed = true
454
+ }
455
+
456
+ // 只比较Hash
457
+ if(!successed && hash_res != null){
458
+ let hash_str = hash_res[0].replace(/^\s+|\s+$/g,"")
459
+ let text_hash_res = text.match(/\[[0-9A-Fa-f]{8,10}\]/)
460
+ if(text_hash_res != null){
461
+ let text_hash = text_hash_res[0].replace(/^\s+|\s+$/g,"")
462
+ if (hash_str === text_hash) {
463
+ successed = true
464
+ }
465
+ }
466
+ }
467
+
468
+ if(successed){
469
+ state.utils.triggerMouseEvent(li, 'mousedown');
470
+ // state.core.actions.output_log(
471
+ // `Note: \'<b style="color:Orange;">${value}</b>\' not found. An approximate match \'<b style="color:Orange;">${li.lastChild.wholeText.trim()}</b>\' has been automatically selected as replacement.`
472
+ // )
473
+ state.core.actions.preset_output_log("alt_option", value, li.lastChild.wholeText.trim())
474
+ break
475
+ }
476
+ }
477
+ }
478
+
479
+ if(!successed && items.length > 0) // 下拉框一个选项都没找到说明就没有这个下拉框,可能是界面设置把下拉框替换成了radio button
480
+ {
481
+ let option_name = store.prefix + id
482
+ if(option_name === "state-setting_sd_model_checkpoint"){
483
+ // 大模型找不到就只用warning提示,因为不影响运行
484
+ // state.core.actions.output_log(`Note: \'<b style="color:Orange;">${value}</b>\' not found.`)
485
+ state.core.actions.preset_output_log("no_option", "stable diffusion checkpoint", value)
486
+ }
487
+ else{
488
+ //state.core.actions.output_log(`Error: \'<b style="color:Red;">${option_name}</b>\' import failed! The option \'<b style="color:Red;">${value}</b>\' was not found!`)
489
+ state.core.actions.preset_output_log("no_option", option_name, value)
490
+ }
491
+ if(hash_res != null){
492
+ let model_name = value
493
+ let hash_str = hash_res[0]
494
+ state.utils.searchCheckPointByHash(hash_str).then( downloadUrl => {
495
+ if(downloadUrl != undefined){
496
+ // let warning_str = encodeURIComponent(`Click to download \
497
+ // <a style ='text-decoration:underline;color:cornflowerblue;', href='${downloadUrl}'> ${model_name} </a>`)
498
+ // state.core.actions.output_warning(warning_str)
499
+ state.core.actions.preset_output_log("download_url", model_name, downloadUrl)
500
+ }
501
+ });
502
+ }
503
+ }
504
+
505
+ state.utils.triggerMouseEvent(input, 'blur');
506
+ selectingQueue -= 1;
507
+ //console.log(`selectingQueue = ${selectingQueue}`)
508
+ }, 100);
509
+
510
+ }, selectingQueue * 200)
511
+ }
512
+
513
+ if(addEvtLsner)
514
+ {
515
+ setTimeout(() => {
516
+ state.utils.onContentChange(select, function (el) {
517
+ let selected = el.querySelector('span.single-select');
518
+ if(force){
519
+ let localized_id = state.utils.getTranslation(id)
520
+ let id_translations = state.utils.reverseTranslation(localized_id)
521
+ //宁可错存一千,也不漏存一个
522
+ for (trans_id of id_translations){
523
+ if (selected) {
524
+ store.set(trans_id, selected.textContent);
525
+ } else {
526
+ // new gradio version...
527
+ let input = el.querySelector('input');
528
+ if (input) {
529
+ store.set(trans_id, input.value);
530
+ }
531
+ }
532
+ }
533
+ }
534
+ else{
535
+ if (selected) {
536
+ store.set(id, selected.textContent);
537
+ } else {
538
+ // new gradio version...
539
+ let input = el.querySelector('input');
540
+ if (input) {
541
+ store.set(id, input.value);
542
+ }
543
+ }
544
+ }
545
+ });
546
+ }, 150);
547
+ }
548
+ } catch (error) {
549
+ console.warn('[state]: Error:', error);
550
+ }
551
+ },
552
+ handleMultipleSelect: function handleMultipleSelect(select, id, store, addEvtLsner=true) {
553
+ try {
554
+ let value = store.get(id);
555
+
556
+ if (value) {
557
+
558
+ value = value.split(',').reverse();
559
+
560
+ if (value.length) {
561
+
562
+ let input = select.querySelector('input');
563
+
564
+ let selectOption = function () {
565
+
566
+ if (! value.length) {
567
+ state.utils.triggerMouseEvent(input, 'blur');
568
+ return;
569
+ }
570
+
571
+ let option = value.pop();
572
+ state.utils.triggerMouseEvent(input, 'focus');
573
+
574
+ setTimeout(() => {
575
+ let successed = false
576
+ let items = Array.from(select.querySelectorAll('ul li'));
577
+ items.forEach(li => {
578
+ if (li.lastChild.wholeText.trim() === option) {
579
+ state.utils.triggerMouseEvent(li, 'mousedown');
580
+ successed = true
581
+ return false;
582
+ }
583
+ });
584
+ if(!successed){
585
+ state.core.actions.preset_output_log("no_option", store.prefix + id, value)
586
+ //state.core.actions.output_log(`Error: \'<b style="color:Red;">${store.prefix + id}</b>\' import failed! The option \'<b style="color:Red;">${value}</b>\' was not found!`)
587
+ }
588
+ setTimeout(selectOption, 100);
589
+ }, 100);
590
+ }
591
+ selectOption();
592
+ }
593
+ }
594
+
595
+ if(addEvtLsner){
596
+ state.utils.onContentChange(select, function (el) {
597
+ const selected = Array.from(el.querySelectorAll('.token > span')).map(item => item.textContent);
598
+ store.set(id, selected);
599
+ });
600
+ }
601
+ } catch (error) {
602
+ console.warn('[state]: Error:', error);
603
+ }
604
+ },
605
+ txtToId: function txtToId(txt) {
606
+ return txt.split(' ').join('-').toLowerCase();
607
+ },
608
+ callXTimes: function callXTimes(func, times) {
609
+ let called = 0;
610
+ return function() {
611
+ if (called < times) {
612
+ called++;
613
+ return func.apply(this);
614
+ }
615
+ }
616
+ },
617
+ saveFile: function saveJSON(fileName ,data) {
618
+ const json = JSON.stringify(data, null, 4);
619
+ const blob = new Blob([json], {type: 'application/json'});
620
+ const url = URL.createObjectURL(blob);
621
+ console.log(url)
622
+ const link = document.createElement('a');
623
+ link.href = url;
624
+ link.download = fileName;
625
+
626
+ document.body.appendChild(link);
627
+ link.click();
628
+ link.parentNode.removeChild(link);
629
+ },
630
+ debounce: function debounce(func, delay) {
631
+ let lastCallTime = 0;
632
+ return function() {
633
+ const currentCallTime = new Date().getTime();
634
+ if (currentCallTime - lastCallTime > delay) {
635
+ lastCallTime = currentCallTime;
636
+ func.apply(this, arguments);
637
+ }
638
+ }
639
+ },
640
+ onNextUiUpdates: function (func) {
641
+ // brute force this to to ensure that the method is called after next few updates
642
+ onUiUpdate(this.callXTimes(function () { setTimeout(func, 5); }, 150));
643
+ }
644
+ };
645
+
646
+ state.utils.html = {
647
+ setStyle: function setStyle(elements, style) {
648
+ if (elements instanceof NodeList) {
649
+ elements = Array.from(elements);
650
+ } else if (elements instanceof Node){
651
+ elements = [elements];
652
+ } else {
653
+ return;
654
+ }
655
+ elements.forEach(element => {
656
+ for (let key in style) {
657
+ if (style.hasOwnProperty(key)) {
658
+ element.style[key] = style[key];
659
+ }
660
+ }
661
+ });
662
+ },
663
+ create: function create(type, props, style) {
664
+ const element = document.createElement(type);
665
+ if (props) {
666
+ for (let key in props) {
667
+ if (props.hasOwnProperty(key)) {
668
+ element[key] = props[key];
669
+ }
670
+ }
671
+ }
672
+ if (style) {
673
+ this.setStyle(element, style);
674
+ }
675
+ return element;
676
+ },
677
+ createButton: function createButton(text, onclick) {
678
+ const btn = document.createElement('button');
679
+ btn.innerHTML = text;
680
+ btn.onclick = onclick || function () {};
681
+ btn.className = 'gr-button gr-button-lg gr-button-primary';
682
+ return btn;
683
+ }
684
+ };
gf/LightDiffusionFlow/preload.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import argparse
2
+
3
+ def preload(parser: argparse.ArgumentParser):
4
+ parser.add_argument("--local-flows-path", type=str, default="models/LightDiffusionFlow", help="Path to save flow files.")
gf/LightDiffusionFlow/scripts/__pycache__/lightdiffusionflow_config.cpython-310.pyc ADDED
Binary file (12.3 kB). View file
 
gf/LightDiffusionFlow/scripts/__pycache__/lightdiffusionflow_version.cpython-310.pyc ADDED
Binary file (223 Bytes). View file
 
gf/LightDiffusionFlow/scripts/__pycache__/state_api.cpython-310.pyc ADDED
Binary file (32 kB). View file
 
gf/LightDiffusionFlow/scripts/__pycache__/state_settings.cpython-310.pyc ADDED
Binary file (1.49 kB). View file
 
gf/LightDiffusionFlow/scripts/lightdiffusionflow_config.py ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,os
2
+ from modules.paths_internal import data_path
3
+
4
+ PNGINFO_2_LIGHTDIFFUSIONFLOW = {}
5
+ PNGINFO_CN_2_LIGHTDIFFUSIONFLOW = {}
6
+ Image_Components_Key = {}
7
+ LoRAs_In_Use = "loras_in_use"
8
+ Flow_Save_mode = "All"
9
+ Auto_Fix_Params = True
10
+ Local_Flows_Path = "models/LightDiffusionFlow"
11
+
12
+ class OutputPrompt_English:
13
+
14
+ def startimport():
15
+ return "<hr style='margin-top:10px;margin-bottom:10px'></hr><b style='color:LimeGreen;'>Start parsing settings...</b>"
16
+
17
+ def invalid_file():
18
+ return "<b style='color:Red;'>Please select a valid lightdiffusionflow or image file!</b>"
19
+
20
+ def importing_image(image_name):
21
+ return f"<b style='color:LimeGreen;'>Importing image: '{image_name}'.</b>"
22
+
23
+ def import_completed():
24
+ return "<b style='color:LimeGreen;'>Import Completed!</b>"
25
+
26
+ def import_completed_info():
27
+ return "Import Completed!"
28
+
29
+ def save_completed():
30
+ return "<b style='color:LimeGreen;'>Save Completed!</b>"
31
+
32
+ def save_failed():
33
+ return "<b style='color:Red;'>Save Failed!</b>"
34
+
35
+ def alternative_option(target_value, new_value):
36
+ return f'''Note: '<b style='color:Orange;'>{target_value}</b>' not found,<br>\
37
+ An approximate match '<b style='color:Orange;'>{new_value}</b>' has been automatically selected as replacement.'''
38
+
39
+ def no_option(option_name, value):
40
+ return f'''Error: '<b style='color:Red;'>{option_name}</b>' import failed!<br>\
41
+ The option '<b style='color:Red;'>{value}</b>' was not found!'''
42
+
43
+ def missing_extensions(ext_list:[]):
44
+ if(Flow_Save_mode == "Core"):
45
+ error_str = "Note: <b style='color:Orange;'>The current flow file contains parameters for other plugins:</b></p>"
46
+ for ext in ext_list:
47
+ error_str+="<p>- <b style='color:Orange;'>"+ext+"</b></p> "
48
+ error_str+="<b style='color:Orange;'>You can switch to 'ALL' mode to load more parameters. (This prompt is for reference only, please choose the plugin mode according to the actual situation.)</b></p> "
49
+ else:
50
+ error_str = "Note: <b style='color:Orange;'>Found missing extensions.</b></p>"
51
+ for ext in ext_list:
52
+ error_str+="<p>- <b style='color:Orange;'>"+ext+"</b></p> "
53
+ error_str+="<b style='color:Orange;'>The above Extension Missing Reminder is for reference only. Please determine the necessary plugins based on your actual needs and specific conditions.</b></p> "
54
+ return error_str
55
+
56
+ def missing_loras(loras_list:[]):
57
+ error_str = "Note: <b style='color:Orange;'>Found missing LoRAs.</b></p>"
58
+ for lora in loras_list:
59
+ error_str+="<p>- <b style='color:Orange;'>"+lora+"</b></p> "
60
+ return error_str
61
+
62
+ def click_to_download(file_name, file_url):
63
+ return f'''<p style="color:Orange;">Click to download \
64
+ <a style ='text-decoration:underline;color:cornflowerblue;', target="_blank", href='{file_url}'> {file_name} </a>
65
+ '''
66
+
67
+ def download_link(file_name, file_url):
68
+ return f'''<a style ='text-decoration:underline;color:cornflowerblue;', target="_blank", href='{file_url}'> {file_name} </a>'''
69
+
70
+ def note_for_save_mode():
71
+ return "Core mode only supports basic parameters for Text-to-Image and Image-to-Image, along with ControlNet parameters. \
72
+ The All mode, on the other hand, aims to support as many parameters as possible on the page, \
73
+ but the downside is that it may occasionally cause the UI to freeze with an infinite loading circle."
74
+
75
+ class OutputPrompt_Chinese:
76
+
77
+ def startimport():
78
+ return "<hr style='margin-top:10px;margin-bottom:10px'></hr><b style='color:LimeGreen;'>开始解析设置...</b>"
79
+
80
+ def invalid_file():
81
+ return "<b style='color:Red;'>请选择一个有效的flow文件,或者含png_info数据的图片!</b>"
82
+
83
+ def importing_image(image_name):
84
+ return f"<b style='color:LimeGreen;'>导入图片'{image_name}'...</b>"
85
+
86
+ def import_completed():
87
+ return "<b style='color:LimeGreen;'>导入完成!</b>"
88
+
89
+ def import_completed_info():
90
+ return "导入完成!"
91
+
92
+ def save_completed():
93
+ return "<b style='color:LimeGreen;'>保存完毕!</b>"
94
+
95
+ def save_failed():
96
+ return "<b style='color:Red;'>保存失败!</b>"
97
+
98
+ def alternative_option(target_value, new_value):
99
+ return f'''注意: 未找到选项'<b style='color:Orange;'>{target_value}</b>',<br>\
100
+ 已使用近似选项'<b style='color:Orange;'>{new_value}</b>'代替.'''
101
+
102
+ def no_option(option_name, value):
103
+ if(option_name == "stable diffusion checkpoint"):
104
+ return f'''未找到大模型'<b style='color:Orange;'>{value}</b>'!'''
105
+ clear_option_name = option_name.replace("state-ext-","")
106
+ return f'''错误: '<b style='color:Red;'>{clear_option_name}</b>'导入失败!<br>\
107
+ 未找到选项'<b style='color:Red;'>{value}</b>'!'''
108
+
109
+ def missing_extensions(ext_list:[]):
110
+ global Flow_Save_mode
111
+ if(Flow_Save_mode == "Core"):
112
+ error_str = "注意, <b style='color:Orange;'>当前flow文件含有其他插件参数:</b></p>"
113
+ for ext in ext_list:
114
+ error_str+="<p>- <b style='color:Orange;'>"+ext+"</b></p> "
115
+ error_str+="<b style='color:Orange;'>可切换至'ALL'模式加载更多参数。(提示仅供参考,请根据实际情况选择插件模式。)</b></p> "
116
+ else:
117
+ error_str = "注意, <b style='color:Orange;'>发现缺失的插件:</b></p>"
118
+ for ext in ext_list:
119
+ error_str+="<p>- <b style='color:Orange;'>"+ext+"</b></p> "
120
+ error_str+="<b style='color:Orange;'>以上插件缺失提示仅供参考,请注意辨别实际情况下您所需要安装的插件。</b></p> "
121
+ return error_str
122
+
123
+ def missing_loras(loras_list:[]):
124
+ error_str = "注意, <b style='color:Orange;'>发现缺失的LoRA模型:</b></p>"
125
+ for lora in loras_list:
126
+ error_str+="<p>- <b style='color:Orange;'>"+lora+"</b></p> "
127
+ return error_str
128
+
129
+ def click_to_download(file_name, file_url):
130
+ name = file_name
131
+ if(name == "ControlNet Models"):
132
+ name = "常用ControlNet模型"
133
+ return f'''<p style="color:Orange;">点击下载 \
134
+ <a style ='text-decoration:underline;color:cornflowerblue;', target="_blank", href='https://pan.quark.cn/s/eafa2a9df949'> 常用ControlNet模型 </a>
135
+ '''
136
+
137
+ return f'''<p style="color:Orange;">点击下载 \
138
+ <a style ='text-decoration:underline;color:cornflowerblue;', target="_blank", href='{file_url}'> {name} </a>
139
+ '''
140
+
141
+ def download_link(file_name, file_url):
142
+ return f'''<a style ='text-decoration:underline;color:cornflowerblue;', target="_blank", href='{file_url}'> {file_name} </a>'''
143
+
144
+ def note_for_save_mode():
145
+ return "Core模式仅支持文生图和图生图的基本参数+ControlNet参数。All模式则会尽可能多的支持页面上的参数,但是缺点是有概率导致UI卡住,无限转圈。"
146
+
147
+
148
+ OutputPrompt = OutputPrompt_English
149
+
150
+ def create_local_flow_path():
151
+ global Local_Flows_Path
152
+
153
+ if os.path.isabs(Local_Flows_Path):
154
+ flows_path = Local_Flows_Path
155
+ else:
156
+ flows_path = os.path.join(data_path, Local_Flows_Path)
157
+ flows_path = flows_path.replace("\\","/") # linux下反斜杠有问题
158
+ #print(flows_path)
159
+ try:
160
+ if(not os.path.exists(flows_path)):
161
+ os.makedirs(flows_path)
162
+ if(os.path.exists(flows_path)):
163
+ print(f"本地文件夹'{flows_path}'创建成功!")
164
+ else:
165
+ print(f"本地文件夹'{flows_path}'创建失败!")
166
+ except BaseException as e:
167
+ pass
168
+ if(not os.path.exists(flows_path)):
169
+ 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.")
170
+ print(f"创建文件夹'{Local_Flows_Path}'失败!请手动创建该文件夹,以保证插件功能正常运行。")
171
+
172
+ Local_Flows_Path = flows_path
173
+
174
+
175
+ # 改成函数调用,修改配置之后能及时刷新
176
+ def init():
177
+ global PNGINFO_2_LIGHTDIFFUSIONFLOW,PNGINFO_CN_2_LIGHTDIFFUSIONFLOW
178
+ global OutputPrompt,Flow_Save_mode,Auto_Fix_Params,Local_Flows_Path,Image_Components_Key
179
+ # PNG Info的功能除了主要的选项以外其他的都靠第三方插件的主动支持,后续再考虑能否有优化的办法
180
+ #print(parameters_copypaste.paste_fields)
181
+ PNGINFO_2_LIGHTDIFFUSIONFLOW = {
182
+ "Prompt": "state-txt2img_prompt",
183
+ "Negative prompt": "state-txt2img_neg_prompt",
184
+ "Steps": "state-txt2img_steps",
185
+ "Sampler": "state-txt2img_sampling",
186
+ "CFG scale": "state-txt2img_cfg_scale",
187
+ "Seed": "state-txt2img_seed",
188
+ "Face restoration": "state-txt2img_restore_faces",
189
+ "Size-1": "state-txt2img_width",
190
+ "Size-2": "state-txt2img_height",
191
+ "Model hash": "state-setting_sd_model_checkpoint",
192
+ "Denoising strength": "state-txt2img_denoising_strength",
193
+ "Hires upscale": "state-txt2img_hr_scale",
194
+ "Hires steps": "state-txt2img_hires_steps",
195
+ "Hires upscaler": "state-txt2img_hr_upscaler",
196
+ "Hires resize-1": "state-txt2img_hr_resize_x",
197
+ "Hires resize-2": "state-txt2img_hr_resize_y",
198
+ "Clip skip": "setting_CLIP_stop_at_last_layers",
199
+ "ENSD": "setting_eta_noise_seed_delta"
200
+ }
201
+
202
+ PNGINFO_CN_2_LIGHTDIFFUSIONFLOW = {
203
+ "Module": "state-ext-control-net-txt2img_0-preprocessor",
204
+ "preprocessor": "state-ext-control-net-txt2img_0-preprocessor",
205
+ "model": "state-ext-control-net-txt2img_0-model",
206
+ "weight": "state-ext-control-net-txt2img_0-control-weight",
207
+ "starting": "state-ext-control-net-txt2img_0-starting-control-step",
208
+ "ending": "state-ext-control-net-txt2img_0-guidance-end-(t)",
209
+ "guidance start": "state-ext-control-net-txt2img_0-starting-control-step",
210
+ "guidance end": "state-ext-control-net-txt2img_0-ending-control-step",
211
+ "resize mode": "state-ext-control-net-txt2img_0-resize-mode",
212
+ "pixel perfect": "state-ext-control-net-txt2img_0-pixel-perfect",
213
+ "control mode": "state-ext-control-net-txt2img_0-control-mode",
214
+ "preprocessor params": ""
215
+ }
216
+
217
+ try:
218
+ import modules.shared as shared
219
+ webui_settings = {}
220
+ with open(shared.cmd_opts.ui_settings_file, mode='r') as f:
221
+ json_str = f.read()
222
+ webui_settings = json.loads(json_str)
223
+
224
+ # ���存模式
225
+ try:
226
+ Flow_Save_mode = webui_settings["lightdiffusionflow-mode"]
227
+ except:
228
+ pass
229
+
230
+ # 自动纠正错误的参数
231
+ try:
232
+ Auto_Fix_Params = webui_settings["lightdiffusionflow-auto-fix-params"]
233
+ except:
234
+ pass
235
+
236
+ # 本地flow保存位置,先读本地设置,再读命令行设置
237
+ try:
238
+ Local_Flows_Path = webui_settings["lightdiffusionflow-local-flows-path"]
239
+ except:
240
+ pass
241
+ if shared.cmd_opts.local_flows_path:
242
+ Local_Flows_Path = shared.cmd_opts.local_flows_path
243
+ create_local_flow_path()
244
+
245
+
246
+ language_successed = False
247
+ auto_language = False
248
+ try:
249
+ # 优先读取自己的设置
250
+ if(webui_settings['lightdiffusionflow-language'] == "default"):
251
+ auto_language = True
252
+ elif(webui_settings['lightdiffusionflow-language'] == "english"):
253
+ OutputPrompt = OutputPrompt_English
254
+ language_successed = True
255
+ else:
256
+ OutputPrompt = OutputPrompt_Chinese
257
+ language_successed = True
258
+ except:
259
+ OutputPrompt = OutputPrompt_English
260
+
261
+ # 如果是default就读取其他设置配合
262
+ if(auto_language and not language_successed):
263
+ # 自带的本地化文件
264
+ localization_files = ["zh_CN", "zh-Hans (Stable) [vladmandic]", "zh-Hans (Stable)",
265
+ "zh-Hans (Testing) [vladmandic]", "zh-Hans (Testing)","chinese-all-1024","chinese-english-1024"]
266
+ try:
267
+ # 如果用户使用了中文汉化文件,插件也默认显示中文
268
+ localization_files.index(webui_settings["localization"])
269
+ OutputPrompt = OutputPrompt_Chinese
270
+ language_successed = True
271
+ except:
272
+ pass
273
+
274
+ # 第三方翻译插件bilingual-localization
275
+ if(not language_successed):
276
+ try:
277
+ if(webui_settings["bilingual_localization_enabled"] and webui_settings["bilingual_localization_file"] != "None"):
278
+ OutputPrompt = OutputPrompt_Chinese
279
+ language_successed = True
280
+ except:
281
+ OutputPrompt = OutputPrompt_English
282
+ except:
283
+ pass
284
+
285
+ Image_Components_Key = [
286
+ # 第一个组件是用来预计算第一张有效图的索引 防止出现有没用的页面跳转
287
+ "useless_Textbox",
288
+ # 每个图片组件的elem_id
289
+ "img2img_image","img2img_sketch","img2maskimg","inpaint_sketch","img_inpaint_base","img_inpaint_mask",
290
+ ] # 只保存图片组件id,其他参数js里搞定
291
+
292
+
293
+ # # init number of controlnet
294
+ # try:
295
+ # webui_settings = {}
296
+ # with open(shared.cmd_opts.ui_settings_file, mode='r') as f:
297
+ # json_str = f.read()
298
+ # webui_settings = json.loads(json_str)
299
+
300
+ # Multi_ControlNet = webui_settings.get("control_net_unit_count", None) # controlnet数量,新版名字
301
+ # if(Multi_ControlNet == None):
302
+ # Multi_ControlNet = webui_settings.get("control_net_max_models_num", 0)
303
+ # print(f"Multi_ControlNet = {Multi_ControlNet}")
304
+ # if(Multi_ControlNet == 1):
305
+ # Image_Components_Key.append(f"txt2img_controlnet_ControlNet_input_image")
306
+ # Image_Components_Key.append(f"img2img_controlnet_ControlNet_input_image")
307
+ # else:
308
+ # for i in range(Multi_ControlNet):
309
+ # Image_Components_Key.append(f"txt2img_controlnet_ControlNet-{i}_input_image")
310
+ # Image_Components_Key.append(f"img2img_controlnet_ControlNet-{i}_input_image")
311
+
312
+ # except:
313
+ # pass
314
+
315
+ # # Segment Anything images
316
+ # Image_Components_Key.extend(["txt2img_sam_input_image","img2img_sam_input_image"])
317
+
318
+
319
+
320
+ init()
gf/LightDiffusionFlow/scripts/lightdiffusionflow_version.py ADDED
@@ -0,0 +1 @@
 
 
1
+ lightdiffusionflow_version = "v2.1.4"
gf/LightDiffusionFlow/scripts/state_api.py ADDED
@@ -0,0 +1,1419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI, Body, HTTPException, Request, Response
2
+ from fastapi.responses import FileResponse
3
+ from pydantic import BaseModel
4
+ import gradio as gr
5
+
6
+ import os, io, sys
7
+ import json
8
+ from PIL import Image
9
+ import re,base64,copy
10
+ import time,requests
11
+ import shutil
12
+ from urllib.parse import urlparse
13
+ import tempfile
14
+
15
+ from modules import localization, images
16
+ import modules.shared as shared
17
+ import modules.scripts as scripts
18
+ import modules.script_callbacks as script_callbacks
19
+ import modules.generation_parameters_copypaste as parameters_copypaste
20
+ from modules.generation_parameters_copypaste import paste_fields, registered_param_bindings, parse_generation_parameters
21
+ from modules.sd_models import checkpoints_list
22
+ from modules import ui_components
23
+ from modules.paths_internal import data_path
24
+ import launch
25
+
26
+ from scripts import lightdiffusionflow_version, lightdiffusionflow_config
27
+ import scripts.lightdiffusionflow_config as lf_config
28
+ # from scripts.lightdiffusionflow_config import OutputPrompt, Flow_Save_mode, Auto_Fix_Params, LoRAs_In_Use #
29
+
30
+ Flow_Save_mode = lf_config.Flow_Save_mode
31
+ Auto_Fix_Params = lf_config.Auto_Fix_Params
32
+ LoRAs_In_Use = lf_config.LoRAs_In_Use
33
+ OutputPrompt = lf_config.OutputPrompt
34
+ Local_Flows_Path = lf_config.Local_Flows_Path #"models/LightDiffusionFlow"
35
+
36
+ # current_path = os.path.abspath(os.path.dirname(__file__))
37
+ # sys.path.append(os.path.join(current_path,"lib"))
38
+ api = None
39
+ workflow_json = {}
40
+ State_Comps = {} # 当前页面的按钮组件
41
+ invisible_buttons = {}
42
+ Webui_Comps = {} # webui上需要操作的图片组件
43
+ Webui_Comps_Cur_Val = [] # 顺序与Image_Components_Key一致
44
+ Output_Log = ""
45
+ g_msg_info = ""
46
+
47
+ conponents_originlist = []
48
+ extensions_conponents = {}
49
+ extensions_id_conponents = {}
50
+ extensions_id_conponents_value = {}
51
+ txt2img_script_container = None
52
+ img2img_script_container = None
53
+
54
+ local_flow_list = []
55
+ Need_Preload = False
56
+ Preload_File = r""
57
+ File_extension = ".flow"
58
+
59
+ paste_symbol = '\u2199\ufe0f' # ↙
60
+ refresh_symbol = '\U0001f504' # 🔄
61
+ save_style_symbol = '\U0001f4be' # 💾
62
+ clear_prompt_symbol = '\U0001f5d1\ufe0f' # 🗑️
63
+ apply_style_symbol = '\U0001f4cb' # 📋
64
+
65
+
66
+ def test_func():
67
+ gr.Warning("hello")
68
+ # global extensions_conponents, extensions_id_conponents
69
+ # global Output_Log
70
+ # print("test_func")
71
+ #print(Output_Log)
72
+ #print(networks.available_networks)
73
+ #print(preprocessor_filters)
74
+
75
+ #print(extensions_id_conponents["dropdown"]["state-ext-control-net-txt2img_0-model"].get_config())
76
+
77
+ # print(parameters_copypaste.paste_fields)
78
+
79
+
80
+ # fastapi触发不了弹窗
81
+ def custom_msg_box():
82
+ global g_msg_info
83
+ if(g_msg_info != ""):
84
+ print(f"gr.Info({g_msg_info})")
85
+ gr.Info(g_msg_info)
86
+ g_msg_info = ""
87
+
88
+ def clear_markup(html_str):
89
+ clearly_str = html_str
90
+ results = re.findall("(<.+?>)",clearly_str)
91
+ for res in results:
92
+ clearly_str = clearly_str.replace(res,"")
93
+ return clearly_str
94
+
95
+ def add_output_log(msg:str="", style:str=""):
96
+ global Output_Log
97
+ if(msg != ""):
98
+ clear_msg = clear_markup(msg)
99
+ print(clear_msg)
100
+ Output_Log += f"<p style='color:rgb(192,192,192);{style}'>{msg}</p>"
101
+
102
+ #custom_msg_box()
103
+ return Output_Log, Output_Log
104
+
105
+ def add_output_warning(msg:str=""):
106
+ add_output_log(msg, style="color:Orange;")
107
+
108
+ def add_output_error(msg:str=""):
109
+ add_output_log(msg, style="color:Red;")
110
+
111
+ def add_preset_output_log(preset, key, value):
112
+ global g_msg_info
113
+ g_msg_info = ""
114
+ if(preset == "start"):
115
+ add_output_log(OutputPrompt.startimport())
116
+ elif(preset == "finished"):
117
+ g_msg_info = OutputPrompt.import_completed_info()
118
+ add_output_log(OutputPrompt.import_completed())
119
+ elif(preset == "invalid"):
120
+ add_output_log(OutputPrompt.invalid_file())
121
+ elif(preset == "importing_img"):
122
+ add_output_log(OutputPrompt.importing_image(key))
123
+ elif(preset == "alt_option"):
124
+ add_output_log(OutputPrompt.alternative_option(key,value))
125
+ elif(preset == "no_option"):
126
+ add_output_log(OutputPrompt.no_option(key,value))
127
+ elif(preset == "missing_exts"):
128
+ ext_list = value.split(";")
129
+ add_output_log(OutputPrompt.missing_extensions(ext_list))
130
+ elif(preset == "missing_loras"):
131
+ lora_list = value.split(";")
132
+ add_output_log(OutputPrompt.missing_loras(lora_list))
133
+ elif(preset == "download_url"):
134
+ add_output_log(OutputPrompt.click_to_download(key, value))
135
+
136
+
137
+ def read_chunks(file, size=io.DEFAULT_BUFFER_SIZE):
138
+ """Yield pieces of data from a file-like object until EOF."""
139
+ while True:
140
+ chunk = file.read(size)
141
+ if not chunk:
142
+ break
143
+ yield chunk
144
+ def gen_file_sha256(filname):
145
+ import hashlib
146
+ """ pip-style sha256 hash generation"""
147
+ print("Use Memory Optimized SHA256")
148
+ blocksize=1 << 20
149
+ sha256_hash = hashlib.sha256()
150
+ length = 0
151
+ with open(os.path.realpath(filname), 'rb') as read_file:
152
+ for block in read_chunks(read_file, size=blocksize):
153
+ length += len(block)
154
+ sha256_hash.update(block)
155
+
156
+ hash_value = sha256_hash.hexdigest()
157
+ print(f"sha256: {hash_value}")
158
+ print(f"length: {length}")
159
+ return hash_value
160
+
161
+ def find_checkpoint_from_name(name:str):
162
+
163
+ for checkpoint in checkpoints_list.keys():
164
+ res = re.search(r"(.+)\.(.+)", checkpoint)
165
+ try:
166
+ if(res.group(1) == name):
167
+ return checkpoint
168
+ except:
169
+ pass
170
+ return name
171
+
172
+ def find_checkpoint_from_hash(hash:str):
173
+
174
+ for checkpoint in checkpoints_list.keys():
175
+ res = re.search(r"\[([0-9a-fA-F]{8,10})\]", checkpoint)
176
+ try:
177
+ if(res.group(1) == hash):
178
+ return checkpoint
179
+ except:
180
+ pass
181
+ return hash
182
+
183
+ def SearchingCheckPointByHashFromCivitai(hash:str):
184
+ hash_str = hash.replace("[","").replace("]","").strip()
185
+ try:
186
+ response = requests.get("https://civitai.com/api/v1/model-versions/by-hash/"+hash_str)
187
+ if(response.status_code == 200):
188
+ #print(response.content)
189
+ return response.json()
190
+ except:
191
+ pass
192
+ return {}
193
+
194
+ def refresh_local_flows(*inputs):
195
+ print("refresh_local_flows")
196
+ global local_flow_list,Local_Flows_Path
197
+ try:
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']
201
+ except:
202
+ local_flow_list = []
203
+ # print(inputs)
204
+ # print(local_flow_list)
205
+ ret = []
206
+ for dd in inputs:
207
+ if dd in local_flow_list:
208
+ selected = dd
209
+ else:
210
+ selected = None
211
+ ret.append(gr.Dropdown.update(choices=local_flow_list, value=selected))
212
+ #ret = [gr.Dropdown.update(choices=local_flow_list, value=selected) for i in inputs]
213
+ return ret
214
+
215
+ def apply_local_flow(selected):
216
+ global local_flow_list,Local_Flows_Path
217
+ global Need_Preload,Preload_File
218
+
219
+ if(selected != "" and selected != None):
220
+ flow_path = os.path.join(Local_Flows_Path, selected)
221
+ if(os.path.exists(flow_path)):
222
+ print("OK,Local File!")
223
+ print(flow_path)
224
+ Preload_File = flow_path
225
+ Need_Preload = True
226
+ gr.Info(clear_markup(OutputPrompt.startimport()))
227
+
228
+ def delete_local_flow(selected):
229
+ global local_flow_list,Local_Flows_Path
230
+ if(selected != "" and selected != None):
231
+ flow_path = os.path.join(Local_Flows_Path, selected)
232
+ if(os.path.exists(flow_path)):
233
+ os.remove(flow_path)
234
+ print("Local File Deleted!")
235
+
236
+ def set_lightdiffusionflow_file():
237
+ global Preload_File
238
+ return Preload_File
239
+
240
+ def on_dropdown_changed(*component):
241
+ global extensions_id_conponents, extensions_id_conponents_value
242
+
243
+ extensions_id_conponents_value["dropdown"] = {}
244
+ i = 0
245
+ for id in extensions_id_conponents["dropdown"].keys():
246
+ extensions_id_conponents_value["dropdown"][id] = component[i]
247
+ i+=1
248
+
249
+ def cn_get_model_type(cn_model_name):
250
+
251
+ cn_type_list = ['canny','depth','normalmap','openpose','mlsd','lineart_anime','lineart','softedge','scribble',
252
+ 'seg','shuffle','tile','inpaint','ip2p','brightness','illumination','qrcode_monster','qrcode','normalbae']
253
+
254
+ type_pattern = "("+"|".join(cn_type_list)+")"
255
+ res = re.search(type_pattern,cn_model_name)
256
+ if(res != None):
257
+ return res.group()
258
+
259
+ return None
260
+
261
+ def set_dropdowns():
262
+ global extensions_id_conponents, workflow_json
263
+ global temp_index,next_index
264
+ global Webui_Comps_Cur_Val, Output_Log
265
+
266
+ temp_index = len(Webui_Comps_Cur_Val)
267
+ next_index = temp_index
268
+
269
+ return_vals = []
270
+ for comp_id in extensions_id_conponents["dropdown"].keys():
271
+ value = None
272
+ new_value = None
273
+ try:
274
+ value = workflow_json.get(comp_id, None)
275
+ if(value == None):
276
+ new_value = extensions_id_conponents["dropdown"][comp_id].get_config()["value"]
277
+ else:
278
+ new_value = value
279
+ matching_successed = False
280
+ options = extensions_id_conponents["dropdown"][comp_id].get_config()["choices"]
281
+
282
+ for option in options:
283
+ if(option == new_value):
284
+ matching_successed = True
285
+ break
286
+ else:
287
+ #print(f"去掉多余文件夹路径---{temp_option}----{temp_new_value}----")
288
+ temp_option = os.path.split(option)[-1]
289
+ temp_new_value = os.path.split(new_value)[-1]
290
+ if(temp_option == temp_new_value):
291
+ matching_successed = True
292
+ break
293
+
294
+ # 去掉模型的多余路径?
295
+ # if(os.path.split(option)[-1] == os.path.split(new_value)[-1]):
296
+ # matching_successed = True
297
+ # break
298
+
299
+ # 没有完全匹配
300
+ if(not matching_successed):
301
+
302
+ # controlnet模型
303
+ res = re.search(r"state-ext-control-net-txt2img_[0-9]-model", comp_id)
304
+ if(res != None):
305
+ cn_model = cn_get_model_type(new_value)
306
+ if(cn_model != None):
307
+ if(len(options) <= 1):
308
+ add_preset_output_log("download_url", "ControlNet Models", "https://huggingface.co/lllyasviel/ControlNet-v1-1/tree/main")
309
+ for option in options:
310
+ if(cn_model == cn_get_model_type(option)):
311
+ new_value = option
312
+ matching_successed = True
313
+ break
314
+
315
+ # 哈希值匹配
316
+ if(not matching_successed):
317
+
318
+ # 寻找哈希值
319
+ value_hash_val = None
320
+ value_no_hash = None
321
+ res = re.search(r"(\[[0-9A-Fa-f]{8,10}\])", new_value)
322
+ if(res != None):
323
+ value_hash_val = res.group(1)
324
+ value_no_hash = new_value.replace(value_hash_val,"").rstrip()
325
+
326
+ for option in options:
327
+
328
+ option_hash_val = None
329
+ option_no_hash = None
330
+ res = re.search(r"(\[[0-9A-Fa-f]{8,10}\])", option)
331
+ if(res != None): # 选项有哈希
332
+ option_hash_val = res.group(1)
333
+ option_no_hash = option.replace(option_hash_val,"").rstrip()
334
+ if(value_hash_val == None): # 值没有哈希
335
+ if(new_value.rstrip() == option_no_hash):
336
+ new_value = option
337
+ matching_successed = True
338
+ break
339
+ else: # 值有哈希
340
+ if(value_hash_val == option_hash_val or option_no_hash == value_no_hash):
341
+ new_value = option
342
+ matching_successed = True
343
+ break
344
+ else: # 选项没有哈希
345
+ if(value_hash_val == None): # 值没有哈希
346
+ if(new_value.rstrip() == option.rstrip()):
347
+ new_value = option
348
+ matching_successed = True
349
+ break
350
+ else: # 值有哈希
351
+ if(value_no_hash == option.rstrip()):
352
+ new_value = option
353
+ matching_successed = True
354
+ break
355
+
356
+ if(matching_successed):
357
+ add_output_log(OutputPrompt.alternative_option(value,new_value))
358
+ #add_output_log(f"Note: '<b style='color:Orange;'>{value}</b>' not found. An approximate match '<b style='color:Orange;'>{new_value}</b>' has been automatically selected as replacement.")
359
+ #print(f"Note: '{value}' not found. An approximate match '{new_value}' has been automatically selected as replacement.")
360
+ else:
361
+ add_output_log(OutputPrompt.no_option(comp_id,value))
362
+ #add_output_log(f"Error: '<b style='color:Red;'>{comp_id}</b>' import failed! The option '<b style='color:Red;'>{value}</b>' was not found!")
363
+ #print(f"'{comp_id}' import failed! The option '{value}' was not found!")
364
+ new_value = extensions_id_conponents["dropdown"][comp_id].get_config()["value"]
365
+
366
+ except KeyError as e:
367
+ print(e)
368
+ return_vals.append(new_value)
369
+
370
+ return_vals.append(temp_index) # 给json2js
371
+ return_vals.append(Output_Log)
372
+ return_vals.append(Output_Log)
373
+ #print(return_vals)
374
+ return tuple(return_vals)
375
+
376
+ def set_js_params():
377
+ global temp_index,next_index
378
+ temp_index = next_index+1
379
+ next_index = temp_index
380
+ print("set_js_params")
381
+ return temp_index
382
+
383
+ # use_elem_id 是为了兼容旧版的图片组件直接使用elem_id作为组件名称的情况
384
+ def comp_create_id(component, tab_name, ext_name, sub_tab, use_elem_id = False):
385
+ comp_id = None
386
+ if(use_elem_id):
387
+ try:
388
+ comp_id = component.elem_id
389
+ except:
390
+ pass
391
+
392
+ if(comp_id == None):
393
+ #try:
394
+ comp_name = component.get_config()['label'].replace(" ", "-").lower()
395
+ temp_sub_tab = ("_"+sub_tab) if sub_tab != "base" else ""
396
+ comp_id = 'state-ext-'+ ext_name.replace(" ","-").lower() + "-" + tab_name + temp_sub_tab + "-" + comp_name
397
+ #except:
398
+ # pass
399
+
400
+ return comp_id
401
+
402
+ def params_create_ids():
403
+ global extensions_id_conponents, extensions_conponents
404
+ extensions_id_conponents = {"dropdown":{}, "image":{}}
405
+
406
+ for key in lf_config.Image_Components_Key:
407
+ if(key == "useless_Textbox"):
408
+ extensions_id_conponents["image"]["useless_Textbox"] = State_Comps["useless_Textbox"]
409
+ else:
410
+ extensions_id_conponents["image"][key] = Webui_Comps[key]
411
+
412
+ for tab_name in extensions_conponents.keys(): # tab name
413
+ for ext_name in extensions_conponents[tab_name].keys(): # plugin name
414
+ comp_index = 0
415
+ for sub_tab in extensions_conponents[tab_name][ext_name].keys(): # sub_tab 如果没有默认就是base
416
+ for comp in extensions_conponents[tab_name][ext_name][sub_tab]: # component
417
+ try:
418
+ # 先只考虑有label的组件
419
+ if(isinstance(comp, gr.Dropdown)):
420
+ # try:
421
+ # comp_name = comp.get_config()['label'].replace(" ", "-").lower()
422
+ # temp_sub_tab = ("_"+sub_tab) if sub_tab != "base" else ""
423
+ # comp_id = 'state-ext-'+ ext_name.replace(" ","-").lower() + "-" + tab_name + temp_sub_tab + "-" + comp_name
424
+ # except:
425
+ # pass
426
+ comp_id = comp_create_id(comp, tab_name, ext_name, sub_tab)
427
+ # comp_name = comp.get_config()['name'] + "_" + str(comp_index)
428
+ # comp_index += 1
429
+ # comp_id = 'state-ext-'+ ext_name.replace(" ","-").lower() + "-" + comp_name
430
+ extensions_id_conponents["dropdown"][comp_id] = comp
431
+ elif(isinstance(comp, gr.Image)):
432
+ comp_id = comp_create_id(comp, tab_name, ext_name, sub_tab, True)
433
+ if("generated_image" in comp_id):
434
+ pass
435
+ #print(f"skip component: {comp_id}")
436
+ else:
437
+ extensions_id_conponents["image"][comp_id] = comp
438
+
439
+ except BaseException as e:
440
+ pass
441
+ #print(extensions_id_conponents)
442
+
443
+ def get_lora_info(using_loras:list):
444
+ import networks
445
+ print(f"using_loras = {using_loras}")
446
+ loras_info = {}
447
+ for lora_name in using_loras:
448
+ for network in networks.available_networks.keys():
449
+ if( (lora_name == networks.available_networks[network].name or lora_name == networks.available_networks[network].alias) and networks.available_networks[network].shorthash != ""):
450
+ print(networks.available_networks[network].filename)
451
+ sha256 = gen_file_sha256(networks.available_networks[network].filename)
452
+ loras_info[sha256] = {
453
+ 'name':networks.available_networks[network].name,
454
+ 'alias':networks.available_networks[network].alias
455
+ }
456
+ print(f"loras_info = {loras_info}")
457
+ return loras_info
458
+
459
+ def get_lora_from_prompt(prompt):
460
+ import networks
461
+
462
+ available_loras = []
463
+ for network in networks.available_networks.keys():
464
+ available_loras.append((networks.available_networks[network].name,networks.available_networks[network].alias))
465
+ #print(available_loras)
466
+
467
+ used_loras = []
468
+ re_lora_prompt = re.compile("<lora:([\w_\s.]+):([ \d.]+)>", re.IGNORECASE)
469
+ results = re.findall(re_lora_prompt, prompt)
470
+ # print("使用到的lora:")
471
+ # print(results)
472
+ for res in results:
473
+ lora_name = res[0]
474
+ for lora in available_loras:
475
+ if(lora_name == lora[0] or lora_name == lora[1]):
476
+ used_loras.append(lora_name)
477
+ return used_loras
478
+
479
+ def get_missing_lora(workflow_json):
480
+ import networks
481
+
482
+ data_str = json.dumps(workflow_json)
483
+ # re_parens = re.compile(r"[\\/\[\](){}]+")
484
+ # prompt = re.sub(
485
+ # re_parens, "", prompt.replace(",", ",")#.replace("-", " ").replace("_", " ")
486
+ # )
487
+
488
+ available_loras = []
489
+ for network in networks.available_networks.keys():
490
+ available_loras.append((networks.available_networks[network].name,networks.available_networks[network].alias))
491
+ #print(available_loras)
492
+
493
+ missing_loras = []
494
+ loras_info = workflow_json[LoRAs_In_Use]
495
+ re_lora_prompt = re.compile("<lora:([\w_\s.]+):([ \d.]+)>", re.IGNORECASE)
496
+ results = re.findall(re_lora_prompt, data_str)
497
+ # print("使用到的lora:")
498
+ # print(results)
499
+ for res in results:
500
+ lora_name = res[0]
501
+ for lora in available_loras:
502
+ if(lora_name == lora[0] or lora_name == lora[1]):
503
+ break
504
+ else:
505
+ # SD默认计算的lora的hash值无法用来在C站搜索,下载链接需要的Hash需单独计算导出才能支持。
506
+ # name,alias,hash,downloadUrl
507
+ for sha256 in loras_info.keys():
508
+ if(loras_info[sha256]["name"] == lora_name or loras_info[sha256]["alias"] == lora_name):
509
+ try:
510
+ model_info = SearchingCheckPointByHashFromCivitai(sha256)
511
+ if(model_info != {}):
512
+ lora_link = OutputPrompt.download_link(lora_name, model_info["downloadUrl"])
513
+ missing_loras.append(lora_link)
514
+ break
515
+ except:
516
+ pass
517
+ else:
518
+ missing_loras.append(lora_name)
519
+ # print("丢失的lora:")
520
+ # print(missing_loras)
521
+ return missing_loras
522
+
523
+ def get_extname_from_label(label):
524
+ ext_name = label
525
+ res = re.search(r"(.+) v[0-9\.]+", ext_name)
526
+ if(res != None):
527
+ ext_name = res.group(1)
528
+ #兼容旧命名
529
+ if(ext_name == "ControlNet"):
530
+ ext_name = "Control-Net"
531
+ return ext_name
532
+
533
+
534
+ def get_script_container(component):
535
+ global txt2img_script_container, img2img_script_container
536
+ if(txt2img_script_container == None):
537
+ temp = component
538
+ #i = 10
539
+ while temp:
540
+ if(temp.elem_id == "txt2img_script_container"):
541
+ txt2img_script_container = temp
542
+ break
543
+ else:
544
+ temp = temp.parent
545
+ #i-=1
546
+
547
+ if(img2img_script_container == None):
548
+ temp = component
549
+ i = 10
550
+ while temp and i>0:
551
+ if(temp.elem_id == "img2img_script_container"):
552
+ img2img_script_container = temp
553
+ break
554
+ else:
555
+ temp = temp.parent
556
+ i-=1
557
+
558
+ def searching_extensions_title():
559
+ global txt2img_script_container, img2img_script_container, extensions_conponents, Flow_Save_mode
560
+
561
+ if(Flow_Save_mode == "Core"):
562
+ extensions_conponents["txt2img"] = {}
563
+ extensions_conponents["img2img"] = {}
564
+ extensions_conponents["txt2img"]["Control-Net"] = {"base":[]}
565
+ extensions_conponents["img2img"]["Control-Net"] = {"base":[]}
566
+
567
+ else:
568
+ for group in txt2img_script_container.children: # 遍历读取所��的插件名称
569
+
570
+ label = ""
571
+ try:
572
+ label = get_extname_from_label(group.children[0].label)
573
+ except BaseException as e:
574
+ pass
575
+
576
+ if(label == ""):
577
+ try:
578
+ label = get_extname_from_label(group.children[0].children[0].label)
579
+ except BaseException as e:
580
+ pass
581
+
582
+ if(label != ""):
583
+ try:
584
+ extensions_conponents["txt2img"]
585
+ except:
586
+ extensions_conponents["txt2img"] = {}
587
+ extensions_conponents["img2img"] = {}
588
+ extensions_conponents["txt2img"][label] = {"base":[]}
589
+ extensions_conponents["img2img"][label] = {"base":[]}
590
+ #extensions_conponents[label] = []
591
+ #print(extensions_conponents)
592
+
593
+ def on_img_changed(*component):
594
+ global extensions_id_conponents, extensions_id_conponents_value
595
+
596
+ #test_vals = []
597
+ extensions_id_conponents_value["image"] = {}
598
+ i = 0
599
+ for id in extensions_id_conponents["image"].keys():
600
+ extensions_id_conponents_value["image"][id] = component[i]
601
+ # if(component[i] == None):
602
+ # test_vals.append("0")
603
+ # else:
604
+ # test_vals.append("1")
605
+ i+=1
606
+
607
+ #print(test_vals)
608
+
609
+ temp_index = -1
610
+ next_index = -1
611
+ def func_for_invisiblebutton():
612
+ global temp_index,next_index
613
+ global extensions_id_conponents, Webui_Comps_Cur_Val, Output_Log
614
+
615
+ temp_index = next_index+1
616
+ next_index = temp_index
617
+
618
+ try:
619
+ while( next_index < len(Webui_Comps_Cur_Val) and Webui_Comps_Cur_Val[next_index+1] == None ):
620
+ next_index += 1
621
+ except:
622
+ pass
623
+
624
+ # try:
625
+ # print(f"func_for_invisiblebutton {temp_index} {next_index} {len(Webui_Comps_Cur_Val)}")
626
+ # print(f"func_for_invisiblebutton {lf_config.Image_Components_Key[temp_index]} {Webui_Comps_Cur_Val[temp_index]} ")
627
+ # except:
628
+ # pass
629
+
630
+
631
+ # 第一个组件是用来预计算第一张图的索引 防止出现有没用的页面跳转 所以不用输出日志信息
632
+ if(temp_index > 0):
633
+ add_output_log(OutputPrompt.importing_image(list(extensions_id_conponents['image'].keys())[temp_index]))
634
+ #add_output_log(f"importing image: \'{list(extensions_id_conponents['image'].keys())[temp_index]}\' ")
635
+
636
+ #if(next_index+1 == len(Webui_Comps_Cur_Val)):
637
+ #add_output_log(OutputPrompt.import_completed())
638
+ #add_output_log(f"import completed!")
639
+
640
+ # 因为显示日志的窗口分txt2img和img2img两个位置 所以两个位置同步导出
641
+ return Webui_Comps_Cur_Val[temp_index], next_index, Output_Log, Output_Log
642
+
643
+
644
+ def config_filter(config):
645
+ global extensions_id_conponents
646
+ new_config = config
647
+ for comp_type in extensions_id_conponents.keys():
648
+ for comp_id in extensions_id_conponents[comp_type].keys():
649
+ try:
650
+ # 筛掉python相关组件的默认值选项
651
+ default_val = extensions_id_conponents[comp_type][comp_id].get_config()["value"]
652
+ if(default_val == new_config[comp_id]):
653
+ del new_config[comp_id]
654
+ except KeyError as e:
655
+ pass
656
+
657
+ if(Auto_Fix_Params == False):
658
+ return new_config
659
+
660
+ # 处理旧版插件保存的错误参数问题
661
+ print("-------错误参数纠正-------")
662
+ found_tabs = []
663
+ fixed_config = {}
664
+ for param in new_config.keys():
665
+ res = re.match("state-ext-control-net-(txt2img|img2img)_([0-9]+)-(.+)",param)
666
+ if(res != None):
667
+ if(res.group(3) not in ["presets","preprocessor","model"]):
668
+ try:
669
+ found_tabs.index(res.group(2))
670
+ except ValueError:
671
+ found_tabs.append(res.group(2))
672
+
673
+ for param in new_config.keys():
674
+
675
+ # 缝缝补补。。。 js保存的参数因为是汉语反推回英文,所以就会有 model->模型->models 的情况。
676
+ res = re.search("[-_](model|models|checkpoint|checkpoints)$",param)
677
+ if(res != None):
678
+ for key in ["model","models","checkpoint","checkpoints"]:
679
+ target_word = str(res.group()).replace(res.group(1),key)
680
+ new_param = re.sub("[-_](model|models|checkpoint|checkpoints)$", target_word, param)
681
+ fixed_config[new_param] = new_config[param]
682
+ #print(f"根据{param},补充{new_param}")
683
+
684
+ # 纠正编号
685
+ res = re.match("state-ext-control-net-(txt2img|img2img)_([0-9]+)-(.+)",param)
686
+ if(res != None):
687
+ tab_num = int(res.group(2))
688
+ if(res.group(2) != "0" and tab_num%3 == 0 ):
689
+ try:
690
+ found_tabs.index(str(tab_num/3))
691
+ # 如果是9 如果发现3的位置有参数,就还需要检查一下1
692
+ if(tab_num == 9):
693
+ found_tabs.index("1")
694
+ except ValueError:
695
+ new_key = f"state-ext-control-net-{res.group(1)}_{int(tab_num/3)}-{res.group(3)}"
696
+ # 这三个选项,旧版是js控制会有序号问题,新版本py控制没有序号问题,所以这里判断纠正之后的位置有没有值,有的话就不动。
697
+ if(res.group(3) in ["presets","preprocessor","model"]):
698
+ #print(param)
699
+ if(new_config.get(new_key,None) == None):
700
+ fixed_config[new_key] = new_config[param]
701
+ print(f" {param} 改为 {new_key}")
702
+ continue
703
+ else:
704
+ fixed_config[new_key] = new_config[param]
705
+ print(f" {param} 改为 {new_key}")
706
+ continue
707
+
708
+ # 其余参数照搬
709
+ fixed_config[param] = new_config[param]
710
+
711
+ #print(fixed_config)
712
+ #print("-------处理错误-------")
713
+
714
+ new_config = fixed_config
715
+ return new_config
716
+
717
+
718
+ def fn_import_workflow(workflow_file):
719
+ global workflow_json, Output_Log
720
+ global extensions_id_conponents, Webui_Comps_Cur_Val, temp_index, next_index
721
+ temp_index = -1 # 重置索引
722
+ next_index = -1
723
+
724
+ workflow_json = {}
725
+ workflow_json_str = ""
726
+ if(workflow_file):
727
+ try:
728
+ config_file = workflow_file[0].name
729
+ except:
730
+ config_file = workflow_file.name
731
+
732
+ print("fn_import_workflow "+str(config_file))
733
+ if (os.path.splitext(config_file)[-1] in [File_extension, ".lightflow", ".json"]): # 兼容部分旧版本文件
734
+ with open(config_file, mode='r', encoding='UTF-8') as f:
735
+ workflow_json_str = f.read()
736
+ workflow_json = json.loads(workflow_json_str)
737
+
738
+ try:
739
+ response = requests.get("https://api.lightflow.ai/openapi/access?action=import")
740
+ if(response.status_code == 200):
741
+ pass
742
+ except:
743
+ pass
744
+
745
+ else:
746
+ print("invalid file!")
747
+
748
+
749
+ workflow_json = config_filter(workflow_json)
750
+
751
+ Webui_Comps_Cur_Val = []
752
+ for key in extensions_id_conponents["image"].keys():
753
+ #for key in lf_config.Image_Components_Key:
754
+ image = None
755
+ successed = 2
756
+ tempkey = key
757
+ while successed > 0:
758
+ try:
759
+ image_data = workflow_json[key]
760
+ matchObj = re.match("data:image/[a-zA-Z0-9]+;base64,",image_data)
761
+ if matchObj != None:
762
+ image_data = image_data[len(matchObj.group()):]
763
+ image_data = base64.decodebytes(image_data.encode('utf-8'))
764
+ image = Image.open(io.BytesIO(image_data))
765
+ successed = 0
766
+ except:
767
+ # 如果是controlnet 第一张图 就修改一下key值重试一遍
768
+ if(key == "txt2img_controlnet_ControlNet_input_image"):
769
+ key = "txt2img_controlnet_ControlNet-0_input_image"
770
+ elif(key == "img2img_controlnet_ControlNet_input_image"):
771
+ key = "img2img_controlnet_ControlNet-0_input_image"
772
+
773
+ elif(key == "txt2img_controlnet_ControlNet-0_input_image"):
774
+ key = "txt2img_controlnet_ControlNet_input_image"
775
+ elif(key == "img2img_controlnet_ControlNet-0_input_image"):
776
+ key = "img2img_controlnet_ControlNet_input_image"
777
+ else:
778
+ successed = 0
779
+ successed-=1
780
+
781
+ Webui_Comps_Cur_Val.append(image)
782
+
783
+ # 检查lora
784
+ missing_loras = []
785
+ try:
786
+ missing_loras = get_missing_lora(workflow_json)
787
+ if(len(missing_loras) > 0):
788
+ add_output_log(OutputPrompt.missing_loras(missing_loras))
789
+
790
+ # # SD默认计算的lora的hash值无法用来在C站搜索,下载链接需要的Hash需单独计算导出才能支持。
791
+ # # name,alias,hash,downloadUrl
792
+ # loras_info = workflow_json[LoRAs_In_Use]
793
+ # for lora_name in missing_loras:
794
+ # for sha256 in loras_info.keys():
795
+ # if(loras_info[sha256]["name"] == lora_name or loras_info[sha256]["alias"] == lora_name):
796
+ # try:
797
+ # model_info = SearchingCheckPointByHashFromCivitai(sha256)
798
+ # if(model_info != {}):
799
+ # add_preset_output_log("download_url", lora_name, model_info["downloadUrl"])
800
+ # except:
801
+ # pass
802
+ except KeyError as e:
803
+ pass
804
+ #print(f"except missing loras error: {e}")
805
+
806
+ #print(Webui_Comps_Cur_Val)
807
+ #set_elements()
808
+ # return_vals.append(str(time.time())) # 用来触发json2js事件,python设置完图片 js继续设置其他参数 弃用
809
+ # return tuple(return_vals)
810
+ return str(temp_index)#, Output_Log, Output_Log
811
+
812
+ class config_params(BaseModel):
813
+ config_data:dict
814
+
815
+ class imgs_callback_params(BaseModel):
816
+ id:str
817
+ img:str
818
+
819
+ class png_info_params(BaseModel):
820
+ img_path:str
821
+
822
+ class file_params(BaseModel):
823
+ file_path:str
824
+
825
+ class savefile_params(BaseModel):
826
+ file_name:str
827
+ file_data:dict
828
+ overwrite:bool
829
+
830
+ class StateApi():
831
+
832
+ BASE_PATH = '/lightdiffusionflow'
833
+
834
+ def get_path(self, path):
835
+ return f"{self.BASE_PATH}{path}"
836
+
837
+ def add_api_route(self, path: str, endpoint, **kwargs):
838
+ return self.app.add_api_route(self.get_path(path), endpoint, **kwargs)
839
+
840
+ def start(self, _: gr.Blocks, app: FastAPI):
841
+ print("----------------- light_diffusion_flow api start------------------")
842
+
843
+ self.app = app
844
+ # 读取本地的config.json
845
+ self.add_api_route('/local/config.json', self.get_config, methods=['GET'])
846
+ # python已经加载好的配置workflow_json 发送给 js
847
+ self.add_api_route('/local/lightdiffusionflow_config', self.get_lightdiffusionflow_config, methods=['GET'])
848
+ self.add_api_route('/local/parse_lora_info', self.parse_lora_info, methods=['POST'])
849
+ # 获取图片的组件id 由js来设置onchange事件
850
+ self.add_api_route('/local/get_imgs_elem_key', self.get_img_elem_key, methods=['GET'])
851
+ # 获取当前已安装的插件列表
852
+ self.add_api_route('/local/get_ext_list', self.get_ext_list, methods=['GET'])
853
+ # 用户设置了新图片 触发回调保存到 workflow_json
854
+ self.add_api_route('/local/imgs_callback', self.imgs_callback, methods=['POST'])
855
+ self.add_api_route('/local/useless_config_filter', self.useless_config_filter, methods=['POST'])
856
+ # 刷新页面之后触发
857
+ self.add_api_route('/local/refresh_ui', self.refresh_ui, methods=['GET'])
858
+ self.add_api_route('/local/output_log', add_output_log, methods=['GET'])
859
+ self.add_api_route('/local/preset_output_log', add_preset_output_log, methods=['GET'])
860
+ self.add_api_route('/local/png_info', self.png_info, methods=['POST']) #
861
+ # 传入一个文件路径,返回文件内容
862
+ self.add_api_route('/local/read_file', self.read_file, methods=['POST'])
863
+ self.add_api_route('/local/file_exist', self.file_exist, methods=['POST'])
864
+ self.add_api_route('/local/need_preload', self.need_preload, methods=['GET'])
865
+ # 保存当前配置到本地文件夹
866
+ self.add_api_route('/local/save_flow_to_local', self.saveFlowToLocal, methods=['POST'])
867
+
868
+ self.add_api_route('/set_preload', self.set_preload, methods=['POST'])
869
+
870
+ def get_config(self):
871
+ return FileResponse(shared.cmd_opts.ui_settings_file)
872
+
873
+ def get_ext_list(self):
874
+ global extensions_conponents
875
+ ext_str = ""
876
+ try:
877
+ ext_str = ",".join(list(extensions_conponents["txt2img"].keys())).lower().replace(" ", "-")
878
+ except:
879
+ pass
880
+ return ext_str
881
+
882
+ def useless_config_filter(self, config:config_params):
883
+ return config_filter(config.config_data)
884
+
885
+ def get_lightdiffusionflow_config(self, data2export:bool = False):
886
+ global workflow_json, extensions_id_conponents, extensions_id_conponents_value
887
+ temp_json = {}
888
+ if(data2export):
889
+
890
+ for key in extensions_id_conponents["image"].keys():
891
+ # for key in lf_config.Image_Components_Key:
892
+ try:
893
+ temp_json[key] = workflow_json[key]
894
+ except:
895
+ pass
896
+
897
+ # using_loras = get_lora_from_prompt(json.dumps(temp_json))
898
+ # temp_json[LoRAs_In_Use] = get_lora_info(using_loras)
899
+
900
+ # 导出时调用,这里把py负责的其他组件一起读进来
901
+ for comp_type in extensions_id_conponents_value.keys():
902
+ for comp_id in extensions_id_conponents_value[comp_type].keys():
903
+ try:
904
+ # 默认值的选项不导出
905
+ default_val = extensions_id_conponents[comp_type][comp_id].get_config()["value"]
906
+ if(default_val != extensions_id_conponents_value[comp_type][comp_id]):
907
+ temp_json[comp_id] = extensions_id_conponents_value[comp_type][comp_id]
908
+ except KeyError as e:
909
+ pass
910
+ else:
911
+ temp_json = copy.deepcopy(workflow_json)
912
+ for key in extensions_id_conponents["image"].keys():
913
+ #for key in lf_config.Image_Components_Key:
914
+ temp_json[key] = ""
915
+
916
+ return json.dumps(temp_json)
917
+
918
+ def parse_lora_info(self, config:config_params):
919
+ temp_json = {}
920
+ json_str = json.dumps(config.config_data)
921
+ using_loras = get_lora_from_prompt(json_str)
922
+ temp_json[LoRAs_In_Use] = get_lora_info(using_loras)
923
+ return temp_json
924
+
925
+ def str_2_json(self, str_data:str):
926
+ out_json = {}
927
+ res = re.findall(r"([^:]+:[^:]{1,})(,|$)",str_data)
928
+ for field in res:
929
+ data = field[0].split(":")
930
+ try:
931
+ out_json[data[0].strip()] = data[1].strip()
932
+ except IndexError as e:
933
+ print(f"str_2_json [key error]: {e}")
934
+ return out_json
935
+
936
+ def png_info(self, img_data:png_info_params):
937
+
938
+ geninfo, items = images.read_info_from_image(Image.open(img_data.img_path))
939
+ geninfo = parse_generation_parameters(geninfo)
940
+ temp_json = {}
941
+ for key in geninfo.keys():
942
+
943
+ matchObj = re.match("ControlNet ([0-9])", key)
944
+ if(matchObj != None): # controlnet
945
+ cn_info = self.str_2_json(geninfo[key])
946
+ if(len(cn_info.keys()) > 0):
947
+ temp_json["state-ext-control-net-txt2img_0-enable".replace("0",matchObj.group(1))] = True
948
+
949
+ for cn_key in cn_info.keys():
950
+ if(cn_key == "starting/ending"):
951
+ cn_key_split = cn_key.split("/")
952
+ data = cn_info[cn_key].replace("(","").replace(")","").split(",")
953
+ temp_json[lf_config.PNGINFO_CN_2_LIGHTDIFFUSIONFLOW[cn_key_split[0]].replace("0",matchObj.group(1))]\
954
+ = data[0].strip()
955
+ temp_json[lf_config.PNGINFO_CN_2_LIGHTDIFFUSIONFLOW[cn_key_split[1]].replace("0",matchObj.group(1))]\
956
+ = data[1].strip()
957
+ elif(cn_key == "pixel perfect"):
958
+ temp_json[lf_config.PNGINFO_CN_2_LIGHTDIFFUSIONFLOW[cn_key].replace("0",matchObj.group(1))]\
959
+ = (cn_info[cn_key].lower() == "true")
960
+ else:
961
+ try:
962
+ temp_json[lf_config.PNGINFO_CN_2_LIGHTDIFFUSIONFLOW[cn_key.lower()].replace("0",matchObj.group(1))] = cn_info[cn_key]
963
+ except KeyError as e:
964
+ print(f"ControlNet option '{cn_key}' parsing failed.")
965
+
966
+ elif(key == "Model hash"):
967
+ target_model = find_checkpoint_from_hash(geninfo[key])
968
+ if(target_model == geninfo[key]):#说明没有找到相同hash值的模型,改用名称查找
969
+ try:
970
+ target_model = find_checkpoint_from_name(geninfo["Model"])
971
+ except:
972
+ pass
973
+ temp_json[lf_config.PNGINFO_2_LIGHTDIFFUSIONFLOW[key]] = target_model
974
+
975
+ elif(key == "Face restoration"):
976
+ temp_json[lf_config.PNGINFO_2_LIGHTDIFFUSIONFLOW[key]] = True
977
+ else:
978
+ try:
979
+ temp_json[lf_config.PNGINFO_2_LIGHTDIFFUSIONFLOW[key]] = geninfo[key]
980
+ except KeyError as e:
981
+ pass
982
+ #print(e)
983
+
984
+ if(key in ["Hires upscale","Hires steps","Hires upscaler","Hires resize-1","Hires resize-2"]):
985
+ temp_json["state-txt2img_enable_hr"] = True
986
+
987
+ return json.dumps(temp_json)
988
+
989
+ def read_file(self, params:file_params):
990
+ print("read_file")
991
+ file_content = ""
992
+ with open(params.file_path, mode='r', encoding='UTF-8') as f:
993
+ file_content = f.read()
994
+ return file_content
995
+
996
+ def file_exist(self, params:file_params):
997
+ print("file_exist")
998
+ if(not os.path.exists(params.file_path)):
999
+ flow_path = os.path.join(Local_Flows_Path, params.file_path)
1000
+ if(os.path.exists(flow_path)):
1001
+ return True
1002
+ else:
1003
+ return False
1004
+ return False
1005
+
1006
+ def get_img_elem_key(self):
1007
+ global extensions_id_conponents
1008
+ keys_str = ""
1009
+ #keys_str = ",".join(lf_config.Image_Components_Key)
1010
+ try:
1011
+ keys_str = ",".join(list(extensions_id_conponents["image"].keys()))
1012
+ except:
1013
+ pass
1014
+ return keys_str
1015
+
1016
+ def imgs_callback(self, img_data:imgs_callback_params):
1017
+ global workflow_json
1018
+ workflow_json[img_data.id] = img_data.img
1019
+
1020
+ def refresh_ui(self):
1021
+ global workflow_json, Output_Log
1022
+ workflow_json = {}
1023
+ Output_Log = ""
1024
+ print("refresh_ui")
1025
+ tag = launch.git_tag()
1026
+ return tag
1027
+
1028
+ def set_preload(self, params:file_params):
1029
+ global Need_Preload,Preload_File
1030
+ print(params.file_path)
1031
+ res = "OK"
1032
+ if(params.file_path):
1033
+ if(os.path.exists(params.file_path)):
1034
+ Preload_File = params.file_path
1035
+ Need_Preload = True
1036
+ res = "OK,Local File!"
1037
+ else:
1038
+ response = requests.get(params.file_path)
1039
+ if(response.status_code == 200):
1040
+ parsed_url = urlparse(params.file_path)
1041
+ file_name = os.path.basename(parsed_url.path)
1042
+ tempdir = os.path.join(tempfile.gettempdir(),"lightdiffusionflow_temp")
1043
+ if(os.path.exists(tempdir)):
1044
+ shutil.rmtree(tempdir)
1045
+ if(not os.path.exists(tempdir)):
1046
+ os.mkdir(tempdir)
1047
+ temp_file = os.path.join(tempdir,file_name)
1048
+
1049
+ with open(temp_file,"wb") as f:
1050
+ f.write(response.content)
1051
+
1052
+ print(temp_file)
1053
+ Preload_File = temp_file
1054
+ Need_Preload = True
1055
+ res = "OK,Network File!"
1056
+ else:
1057
+ res = "Invalid File!"
1058
+
1059
+ return res
1060
+
1061
+ def need_preload(self):
1062
+ global Need_Preload,Preload_File
1063
+ if(Need_Preload):
1064
+ Need_Preload = False
1065
+ return Preload_File
1066
+ return ""
1067
+
1068
+ def saveFlowToLocal(self, data_to_save:savefile_params):
1069
+ global Local_Flows_Path
1070
+ global add_output_log
1071
+
1072
+ overall_data = {}
1073
+ print(data_to_save.file_name)
1074
+ print(data_to_save.file_data)
1075
+ filedata = data_to_save.file_data
1076
+
1077
+ # python处理的图片和dropdown信息
1078
+ overall_data = json.loads(self.get_lightdiffusionflow_config(True))
1079
+ for key in filedata.keys():
1080
+ if(filedata[key] != ""):
1081
+ overall_data[key] = filedata[key]
1082
+
1083
+ # Lora信息
1084
+ params = config_params(config_data=overall_data)
1085
+ lora_info = self.parse_lora_info(params)
1086
+ for key in lora_info.keys():
1087
+ overall_data[key] = lora_info[key]
1088
+
1089
+ # 过滤掉一些没用的默认值的信息
1090
+ overall_data = config_filter(overall_data)
1091
+
1092
+ flow_path = os.path.join(Local_Flows_Path, data_to_save.file_name)
1093
+ print(flow_path)
1094
+ if(not os.path.exists(flow_path) or (data_to_save.overwrite)):
1095
+ with open(flow_path,"w") as f:
1096
+ #json.dump(overall_data,f)
1097
+ f.write(json.dumps(overall_data, ensure_ascii=False, indent=4))
1098
+ add_output_log(OutputPrompt.save_completed())
1099
+ else:
1100
+ add_output_log(OutputPrompt.save_failed())
1101
+
1102
+ return flow_path
1103
+
1104
+ class Script(scripts.Script):
1105
+
1106
+ def __init__(self) -> None:
1107
+ super().__init__()
1108
+ #记录无id元素的id
1109
+ self.new_ids={}
1110
+
1111
+ def title(self):
1112
+ return "lightdiffusionflow plugin"
1113
+
1114
+ def show(self, is_img2img):
1115
+ return scripts.AlwaysVisible
1116
+
1117
+ def after_component(self, component, **kwargs):
1118
+ '''
1119
+ python触发导入事件,按正常触发逻辑先执行js代码,把除图片以外的参数全部设置好,
1120
+ 然后回到python代码,读取图片保存到Webui_Comps_Cur_Val,
1121
+ 再用json2js的onchange事件触发js来点击隐藏按钮开始触发设置图片的事件队列。
1122
+ 代码从on_after_component 移到script里的after_component:
1123
+ txt2img和img2img面板以外的组件回调不再有效
1124
+ 但是可以读取self.is_img2img确定当前组件存在的面板
1125
+ '''
1126
+ # #当前模式
1127
+ # teb_mode="img2img" if self.is_img2img else "txt2img"
1128
+ # #空id补全方法
1129
+ # def in_zone(dom,id=""):
1130
+ # if dom:
1131
+ # if dom.elem_id:
1132
+ # id+="-"+dom.elem_id
1133
+ # return in_zone(dom.parent,id)
1134
+ # elif dom.elem_classes and dom.elem_classes[0]!='gradio-blocks':
1135
+ # if dom.elem_classes[0]=='gradio-accordion':
1136
+ # id+='-'+dom.label+"?"
1137
+ # return in_zone(dom.parent,id)
1138
+ # if re.search('2img_(textual|hypernetworks|checkpoints|lora)_',id):
1139
+ # return False
1140
+ # else:
1141
+ # id=re.sub(r'\?[^\?]+$|[ \?]','',id)
1142
+ # if id in self.new_ids:
1143
+ # self.new_ids[id]+=1
1144
+ # else:
1145
+ # self.new_ids[id]=1
1146
+ # return id+'-'+str(self.new_ids[id])
1147
+
1148
+ # #记录组件
1149
+ # try:
1150
+ # #拉取id
1151
+ # id=component.elem_id
1152
+ # #若没有就重构
1153
+ # if id==None:
1154
+ # id=component.elem_id==in_zone(component.parent,teb_mode)
1155
+ # Webui_Comps[id] = component
1156
+ # except BaseException as e:
1157
+ # pass
1158
+
1159
+ global txt2img_script_container, img2img_script_container, extensions_id_conponents, extensions_conponents
1160
+
1161
+ conponents_originlist.append((component, 'img2img' if self.is_img2img else 'txt2img'))
1162
+ #print(f"after_component {component} {kwargs.get('elem_id', None)} {'img2img' if self.is_img2img else 'txt2img'} ")
1163
+ try:
1164
+
1165
+ if kwargs["elem_id"] == "txt2img_generation_info_button": # or kwargs["elem_id"] == "img2img_generation_info_button":
1166
+ self.custom_ui()
1167
+
1168
+ if(Webui_Comps.get(kwargs["elem_id"], None) == None):
1169
+ Webui_Comps[kwargs["elem_id"]] = component
1170
+ #print(kwargs["elem_id"])
1171
+
1172
+ except BaseException as e:
1173
+ pass
1174
+
1175
+ get_script_container(component)
1176
+
1177
+ if (isinstance(component, gr.Button) and kwargs["elem_id"] == "img2img_generation_info_button"): # 加载到最后一个组件了。 兼容旧版,暂时不使用“img2img_preview_filename”
1178
+
1179
+ searching_extensions_title()
1180
+ #print(extensions_conponents)
1181
+
1182
+ for comp_tuple in conponents_originlist:
1183
+ comp = comp_tuple[0]
1184
+ temp_parent = comp.parent
1185
+ mode_tab = comp_tuple[1]
1186
+ tab = None
1187
+ tabs = None
1188
+ ext_name = ""
1189
+
1190
+ # --------------------------------------组件分类--------------------------------------------------
1191
+ while temp_parent:
1192
+ try:
1193
+ # tab 如果有多层只存最上层
1194
+ if(isinstance(temp_parent,gr.Tab)):
1195
+ tab = temp_parent
1196
+ if(isinstance(temp_parent,gr.Tabs)):
1197
+ tabs = temp_parent
1198
+
1199
+ temp_ext_name = get_extname_from_label(temp_parent.label)
1200
+ if(extensions_conponents[mode_tab].get(temp_ext_name, None) != None):
1201
+ ext_name = temp_ext_name
1202
+ break
1203
+ except BaseException as e:
1204
+ pass
1205
+ temp_parent = temp_parent.parent
1206
+
1207
+ try:
1208
+ if(tabs):
1209
+ tab_index = 0
1210
+ for temp_tab in tabs.children:
1211
+ if (tab == temp_tab):
1212
+ break
1213
+ tab_index+=1
1214
+ if(extensions_conponents[mode_tab][ext_name].get(str(tab_index), None) != None):
1215
+ extensions_conponents[mode_tab][ext_name][str(tab_index)].append(comp)
1216
+ else:
1217
+ extensions_conponents[mode_tab][ext_name][str(tab_index)] = [comp]
1218
+ else:
1219
+ extensions_conponents[mode_tab][ext_name]["base"].append(comp)
1220
+ except KeyError as e:
1221
+ pass
1222
+
1223
+ # print(extensions_conponents) # 整理好的第三方插件用到的组件
1224
+ # --------------------------------------组件分类--------------------------------------------------
1225
+
1226
+ if(self.is_img2img):
1227
+ State_Comps["useless_Textbox"] = \
1228
+ gr.Textbox(value='useless_Textbox', elem_id='useless_Textbox', visible=False)
1229
+
1230
+ params_create_ids()
1231
+
1232
+ # img2img下的面板
1233
+ self.custom_ui()
1234
+
1235
+ target_comps = []
1236
+ target_comps.append(State_Comps["json2js"]) # 触发事件传递json给js
1237
+ #target_comps.append(State_Comps["outlog"][0])
1238
+ #target_comps.append(State_Comps["outlog"][1]) # 因为显示日志的窗口分txt2img和img2img两个位置 所以两个位置同步导出
1239
+
1240
+ for i in range(len(State_Comps["local_flows"])):
1241
+ #State_Comps["local_flows"]
1242
+ State_Comps["refresh"][i].click(refresh_local_flows, inputs=State_Comps["local_flows"],outputs=State_Comps["local_flows"])
1243
+ State_Comps["apply"][i].click(apply_local_flow, inputs=[State_Comps["local_flows"][i]],outputs=[])
1244
+ State_Comps["save"][i].click(fn=None,_js="state.core.actions.saveFlowToLocal", inputs=[],outputs=[])
1245
+ #State_Comps["delete"][i].click(delete_local_flow, inputs=[State_Comps["local_flows"][i]],outputs=State_Comps["local_flows"])
1246
+
1247
+
1248
+ for btn in State_Comps["export"]:
1249
+ btn.click(None,_js="state.core.actions.exportState") #, inputs=[],outputs=[]
1250
+
1251
+ for btn in State_Comps["import"]:
1252
+ # js里加载除图片以外的参数 python加载图片
1253
+ btn.upload(fn_import_workflow, _js=f"state.core.actions.handleLightDiffusionFlow",
1254
+ inputs=[btn],outputs=target_comps, show_progress=False)
1255
+
1256
+ State_Comps["json2js"].change(fn=None,_js="state.core.actions.startImportImage",
1257
+ inputs=[State_Comps["json2js"]])
1258
+
1259
+ State_Comps["test_button"].click(test_func,_js="state.utils.testFunction",inputs=[])
1260
+
1261
+ State_Comps["refresh_log"].click(add_output_log,inputs=[],outputs=[State_Comps["outlog"][0], State_Comps["outlog"][1]])
1262
+
1263
+ on_dropdown_change_inputs = list(extensions_id_conponents["dropdown"].values())
1264
+ for comp_to_bind in extensions_id_conponents["dropdown"].keys():
1265
+ extensions_id_conponents["dropdown"][comp_to_bind].change(on_dropdown_changed,inputs=on_dropdown_change_inputs,outputs=[])
1266
+
1267
+ # change事件,每次上传一张图会触发change时间几十次
1268
+ # clear事件,删除图片的时候不触发,官方bug好像新版本有解决。
1269
+ # edit事件,每次编辑都能触发一次,上传图片的时候也能触发。
1270
+ # 没有合适的清除图片的事件,无法使用python监控图片组件
1271
+ # on_img_change_inputs = list(extensions_id_conponents["image"].values())
1272
+ # for comp_to_bind in extensions_id_conponents["image"].keys():
1273
+ # extensions_id_conponents["image"][comp_to_bind].edit(on_img_changed,inputs=on_img_change_inputs,outputs=[])
1274
+ # extensions_id_conponents["image"][comp_to_bind].clear(on_img_changed,inputs=on_img_change_inputs,outputs=[])
1275
+
1276
+ temp_dropdown_outputs = list(extensions_id_conponents["dropdown"].values())
1277
+ temp_dropdown_outputs.append(State_Comps["json2js"]) # json2js触发完成事件
1278
+ temp_dropdown_outputs.append(State_Comps["outlog"][0]) # 输出日志
1279
+ temp_dropdown_outputs.append(State_Comps["outlog"][1]) # 输出日志
1280
+ State_Comps["set_dropdowns"].click(set_dropdowns,inputs=[],outputs=temp_dropdown_outputs,show_progress=False)
1281
+
1282
+ State_Comps["set_js_params"].click(set_js_params,inputs=[],outputs=State_Comps["json2js"])
1283
+
1284
+ input_component = State_Comps["background_import"] #State_Comps["import"][0]
1285
+ State_Comps["set_file_button"].click(set_lightdiffusionflow_file,inputs=[],outputs=[input_component])
1286
+ State_Comps["preload_button"].click(fn_import_workflow, _js=f"state.core.actions.handleLightDiffusionFlow",
1287
+ inputs=[input_component],outputs=target_comps)
1288
+
1289
+ for key in invisible_buttons.keys():
1290
+ segs = key.split("_")
1291
+ comp_name = "_".join(segs[2:])
1292
+ #print(comp_name)
1293
+ try:
1294
+ invisible_buttons[key].click(func_for_invisiblebutton,
1295
+ inputs=[],
1296
+ outputs=[
1297
+ #Webui_Comps[comp_name],
1298
+ extensions_id_conponents["image"][comp_name],
1299
+ State_Comps["json2js"],
1300
+ State_Comps["outlog"][0],
1301
+ State_Comps["outlog"][1]
1302
+ ])
1303
+ except KeyError:
1304
+ print(f"No such component: {comp_name}")
1305
+
1306
+ print("LightDiffusionFlow 绑定完成")
1307
+
1308
+ def ui(self, is_img2img):
1309
+ pass
1310
+
1311
+ def custom_ui(self):
1312
+ global File_extension, extensions_id_conponents
1313
+ try:
1314
+ State_Comps["import"]
1315
+ State_Comps["export"]
1316
+ State_Comps["outlog"]
1317
+ State_Comps["local_flows"]
1318
+ State_Comps["apply"]
1319
+ State_Comps["delete"]
1320
+ State_Comps["save"]
1321
+ State_Comps["refresh"]
1322
+ except:
1323
+ State_Comps["import"] = []
1324
+ State_Comps["export"] = []
1325
+ State_Comps["outlog"] = []
1326
+ State_Comps["local_flows"] = []
1327
+ State_Comps["apply"] = []
1328
+ State_Comps["delete"] = []
1329
+ State_Comps["save"] = []
1330
+ State_Comps["refresh"] = []
1331
+
1332
+
1333
+ cur_mode = "img2img" if self.is_img2img else "txt2img"
1334
+ save_mode = " (for all extensions)"
1335
+ if(Flow_Save_mode == "Core"):
1336
+ save_mode = " (only ControlNet)"
1337
+
1338
+ global local_flow_list,Local_Flows_Path
1339
+ try:
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']
1343
+ except:
1344
+ local_flow_list = []
1345
+
1346
+ with gr.Accordion('LightDiffusionFlow '+lightdiffusionflow_version.lightdiffusionflow_version + save_mode, open=True, visible=True, elem_id=cur_mode+'_lightdiffusionflow'):
1347
+
1348
+ with gr.Row():
1349
+ State_Comps["local_flows"].append(gr.Dropdown(label="", show_label=False , multiselect=False, choices=local_flow_list,value='',elem_id=cur_mode+'_ldf_local_flows'))
1350
+ State_Comps["apply"].append(ui_components.ToolButton(value=paste_symbol,elem_id=cur_mode+'_ldf_apply'))
1351
+ #State_Comps["delete"].append(ui_components.ToolButton(value=clear_prompt_symbol,elem_id=cur_mode+'_ldf_delete'))
1352
+ State_Comps["save"].append(ui_components.ToolButton(value=save_style_symbol,elem_id=cur_mode+'_ldf_save'))
1353
+ State_Comps["refresh"].append(ui_components.ToolButton(value=refresh_symbol,elem_id=cur_mode+'_ldf_refresh'))
1354
+
1355
+ with gr.Row():
1356
+ gr.HTML(label="",value="<hr style='margin-top:10px;margin-bottom:10px'></hr>")
1357
+
1358
+ with gr.Row():
1359
+ lightdiffusionflow_file = gr.File(label="LightDiffusionFlow File",file_count="single", file_types=[File_extension], elem_id=cur_mode+'_ldf_import')
1360
+ State_Comps["import"].append(lightdiffusionflow_file)
1361
+
1362
+ with gr.Column(scale=1):
1363
+ gr.HTML(label="",value='''
1364
+ <a style ="text-decoration:underline;color:cornflowerblue;",
1365
+ href="https://www.lightflow.ai/">开源社区/open-source community</a>''')
1366
+ State_Comps["outlog"].append(gr.HTML(label="Output Log",elem_id=cur_mode+'_ldf_outlog',value='''
1367
+ <p style=color:Red;>Welcome to LightDiffusionFlow! \(^o^)/~</p>
1368
+ <p style=color:MediumSeaGreen;>Welcome to LightDiffusionFlow! \(^o^)/~</p>
1369
+ <p style=color:DodgerBlue;>Welcome to LightDiffusionFlow! \(^o^)/~</p>'''))
1370
+
1371
+ with gr.Row():
1372
+ export_config = gr.Button(value='导出/Export',elem_id=cur_mode+'_ldf_export')
1373
+ State_Comps["export"].append(export_config)
1374
+
1375
+ if(self.is_img2img):
1376
+ State_Comps["background_import"] = gr.File(label="LightDiffusionFlow File",file_count="single",
1377
+ file_types=[File_extension],visible=False)
1378
+ State_Comps["json2js"] = gr.Textbox(label="json2js",visible=False)
1379
+ State_Comps["test_button"] = gr.Button(value='测试',elem_id='test_button',visible=True)
1380
+ State_Comps["refresh_log"] = gr.Button(value='刷新日志',elem_id='img2img_invisible_refresh_log',visible=False)
1381
+ State_Comps["set_dropdowns"] = gr.Button(value='设置部分参数',elem_id='lightdiffusionflow_set_dropdowns',visible=False)
1382
+ State_Comps["set_js_params"] = gr.Button(value='设置剩下的js参数',elem_id='lightdiffusionflow_set_js_params',visible=False)
1383
+ State_Comps["set_file_button"] = gr.Button(value='设置文件',elem_id='set_lightdiffusionflow_file',visible=False)
1384
+ State_Comps["preload_button"] = gr.Button(value='预加载',elem_id='preload_button',visible=False)
1385
+
1386
+ with gr.Row():
1387
+ #State_Comps["useless_Textbox"] = \
1388
+ # gr.Textbox(value='useless_Textbox', elem_id='useless_Textbox', visible=False)
1389
+
1390
+ #for key in lf_config.Image_Components_Key:
1391
+ for key in extensions_id_conponents["image"].keys():
1392
+ #print(key)
1393
+ elem_id = ("img2img_" if self.is_img2img else "txt2img_") + "invisible_" + key
1394
+ invisible_buttons[elem_id] = gr.Button(value=elem_id, elem_id=elem_id, visible=False)
1395
+
1396
+
1397
+
1398
+ def on_after_component(component, **kwargs):
1399
+ global Webui_Comps
1400
+
1401
+ # img2img和txt2img面板以外的组件信息只能在这里获取
1402
+ # 如果希望python里控制这些组件,还需要把部分代码移到这里实现
1403
+ try:
1404
+ if(Webui_Comps.get(kwargs["elem_id"], None) == None):
1405
+ Webui_Comps[kwargs["elem_id"]] = component
1406
+ #if( kwargs["elem_id"] == "setting_sd_model_checkpoint"):
1407
+ # print("--------------setting_sd_model_checkpoint---------------")
1408
+ except KeyError:
1409
+ pass
1410
+
1411
+
1412
+ def on_before_reload():
1413
+ lightdiffusionflow_config.init()
1414
+
1415
+ # add callbacks
1416
+ api = StateApi()
1417
+ script_callbacks.on_app_started(api.start)
1418
+ script_callbacks.on_after_component(on_after_component)
1419
+ script_callbacks.on_before_reload(on_before_reload)
gf/LightDiffusionFlow/scripts/state_settings.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import modules.shared as shared
3
+ from modules import scripts
4
+ from scripts import lightdiffusionflow_config
5
+ #from scripts.lightdiffusionflow_config import OutputPrompt
6
+ OutputPrompt = lightdiffusionflow_config.OutputPrompt
7
+
8
+ def on_ui_settings():
9
+
10
+ section = ("lightdiffusionflow", "Light Diffusion Flow")
11
+
12
+ # "sd_lora": shared.OptionInfo("None", "Add network to prompt", gr.Dropdown,
13
+ # lambda: {"choices": ["None", *networks.available_networks]}, refresh=networks.list_available_networks),
14
+ shared.opts.add_option("lightdiffusionflow-language",
15
+ shared.OptionInfo(
16
+ "default",
17
+ "显示语言/Language",
18
+ gr.Dropdown,
19
+ lambda: {
20
+ "choices": ["default","中文","english"]
21
+ }, section=section)
22
+ )
23
+
24
+ shared.opts.add_option("lightdiffusionflow-mode",
25
+ shared.OptionInfo(
26
+ "All",
27
+ f"模式/Mode: ({OutputPrompt.note_for_save_mode()})",
28
+ gr.Dropdown,
29
+ lambda: {
30
+ "choices": ["Core","All"]
31
+ }, section=section)
32
+ )
33
+
34
+ shared.opts.add_option("lightdiffusionflow-local-flows-path",
35
+ shared.OptionInfo(
36
+ default="models/LightDiffusionFlow",
37
+ label=f"本地保存的flow文件路径/Local path to save flow files",
38
+ #component=gr.TextBox,
39
+ section=section)
40
+ )
41
+
42
+ shared.opts.add_option("lightdiffusionflow-auto-fix-params",
43
+ shared.OptionInfo(
44
+ True,
45
+ f"自动纠正错误的参数/Automatically fix incorrect parameters",
46
+ gr.Checkbox,
47
+ {"interactive": True},
48
+ section=section)
49
+ )
50
+
51
+
52
+ scripts.script_callbacks.on_ui_settings(on_ui_settings)
gf/LightDiffusionFlow/style.css ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #settings_state_buttons button,
2
+ #settings_state_buttons input[type="file"] {
3
+ color: white;
4
+ background: rgb(249, 115, 22);
5
+ border-radius: 8px;
6
+ padding: 5px 15px;
7
+ font-weight: bold;
8
+ font-size: 16px;
9
+ margin-left: 5px;
10
+ margin-right: 5px;
11
+ }
12
+
13
+ #settings_state_buttons input[type="file"] {
14
+ padding: 3px 5px;
15
+ }
16
+
17
+ #settings_state hr {
18
+ margin-top: 32px;
19
+ margin-bottom: 32px;
20
+ }
gf/a1111-stable-diffusion-webui-vram-estimator/.gitignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ .DS_Store
2
+ .idea
3
+ *.log
4
+ tmp/
5
+
6
+ stats.json
gf/a1111-stable-diffusion-webui-vram-estimator/LICENSE ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright 2023 space-nuko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
gf/a1111-stable-diffusion-webui-vram-estimator/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VRAM Estimator for stable-diffusion-webui
2
+
3
+ When using stable-diffusion-webui, if you find yourself frequently running out of VRAM or worried that pushing your settings too far will break your webui, this extension might be of use. It gathers a set of statistics based on running `txt2img` and `img2img` with various different settings and uses extrapolation to estimate the amount of VRAM your settings will use.
4
+
5
+ ![Preview](./static/preview.png)
6
+
7
+ ## Usage
8
+
9
+ First you will need to gather some data from running a bunch of image generations for the extension to use (you'll only have to do this step once). Go to the `VRAM Estimator` tab and set the `Max Image Size` and `Max Batch Count` parameters to the maximum that your system can handle when generating with `txt2img` and Hires Fix enabled (Hires Fix uses more VRAM than plain `txt2img` even when the target resolution is the same). The default settings of size 960 and 8 batch count are appropriate for an RTX 3090. Make sure you've closed any other programs that can take up VRAM, then click `Run Benchmark` and watch the console for progress. The benchmark will generate several images at different resolutions with `txt2img` and `img2img` and save the VRAM used by each run.
10
+
11
+ After the benchmark has finished, you can go to the `txt2img` or `img2img` tab and adjust the sliders for Width/Height/Hires Fix to see the estimated VRAM usage. Note that the estimate is based on the amount of used VRAM on your system at the time you change the slider. As a rule of thumb you should expect about 1 GB more of VRAM to actually be used by the generating operation you choose.
12
+
13
+ Also note that this extension does not take into account VRAM allocated by other extensions like ControlNet; it only looks at the width, height and batch count of the vanilla generation config. If you update webui, it's worth running the benchmark again if you find the estimates are no longer accurate.
gf/a1111-stable-diffusion-webui-vram-estimator/scripts/__pycache__/vram_estimator.cpython-310.pyc ADDED
Binary file (12.4 kB). View file
 
gf/a1111-stable-diffusion-webui-vram-estimator/scripts/vram_estimator.py ADDED
@@ -0,0 +1,405 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ import logging
3
+ import socket
4
+ import json
5
+ import math
6
+ import os.path
7
+ import torch.cuda
8
+ import numpy as np
9
+ import scipy.linalg
10
+ import scipy.optimize
11
+ from collections import defaultdict
12
+ from hashlib import sha256
13
+ from PIL import Image
14
+ from logging.handlers import SysLogHandler
15
+ from modules import shared, script_callbacks, devices, scripts
16
+ from modules.processing import StableDiffusionProcessingTxt2Img, StableDiffusionProcessingImg2Img, Processed, process_images
17
+ import gradio as gr
18
+ import pandas as pd
19
+
20
+
21
+ curves = {}
22
+ stats_file = os.path.join(scripts.basedir(), "stats.json")
23
+
24
+
25
+ class VRAMCurve():
26
+ """3d plane where x=pixels, y=batch_size, z=reserved_peak"""
27
+ def __init__(self, data):
28
+ arr = []
29
+ batch_sizes_x = defaultdict(list)
30
+ batch_sizes_y = defaultdict(list)
31
+ for entry in data:
32
+ size = math.sqrt(entry["pixels"])
33
+ batch_size = entry["batch_size"]
34
+ reserved = entry["reserved_peak"]
35
+
36
+ arr.append([size, batch_size, reserved])
37
+ batch_sizes_x[batch_size].append(size)
38
+ batch_sizes_y[batch_size].append(reserved)
39
+
40
+ data = np.array(arr)
41
+
42
+ # VRAM usage seems to scale linearly within one batch size, but the rate
43
+ # of increase differs between batch sizes with no real pattern
44
+ self.batch_sizes = {}
45
+ for k in batch_sizes_x.keys():
46
+ z = np.polyfit(batch_sizes_x[k], batch_sizes_y[k], 3)
47
+ f = np.poly1d(z)
48
+ self.batch_sizes[k] = f
49
+
50
+ # best-fit cubic curve
51
+ # M = [ones(size(x)), x, y, x.^2, x.*y, y.^2, x.^3, x.^2.*y, x.*y.^2, y.^3]
52
+ A = np.c_[np.ones(data.shape[0]), data[:,:2], data[:,0]**2, np.prod(data[:,:2], axis=1), \
53
+ data[:,1]**2, data[:,0]**3, np.prod(np.c_[data[:,0]**2,data[:,1]],axis=1), \
54
+ np.prod(np.c_[data[:,0],data[:,1]**2],axis=1), data[:,1]**3]
55
+ self.C,_,_,_ = scipy.linalg.lstsq(A, data[:,2])
56
+
57
+ def estimate(self, pixels, batch_size):
58
+ x = math.sqrt(pixels)
59
+ y = batch_size
60
+
61
+ if batch_size in self.batch_sizes:
62
+ return self.batch_sizes[batch_size](x)
63
+
64
+ return np.dot([1, x, y,
65
+ x ** 2, x * y, y ** 2,
66
+ x ** 3, x ** 2 * y, x * y ** 2, y ** 3], self.C)
67
+
68
+
69
+ def load_curve():
70
+ global curves
71
+ if not os.path.isfile(stats_file):
72
+ print("[VRAMEstimator] No stats available, run benchmark first")
73
+ return None, None
74
+
75
+ with open(stats_file, "r", encoding="utf-8") as f:
76
+ data = json.load(f)
77
+
78
+ if "txt2img" not in data or "txt2img_hr" not in data or "txt2img_hr_latent" not in data or "img2img" not in data:
79
+ print("[VRAMEstimator] No stats available, run benchmark first")
80
+ return None, None
81
+
82
+ curves = {}
83
+ for k, v in data.items():
84
+ curves[k] = VRAMCurve(v)
85
+
86
+ print("[VRAMEstimator] Loaded benchmark data.")
87
+ return make_plots(data)
88
+
89
+
90
+ def get_memory_stats():
91
+ devices.torch_gc()
92
+ torch.cuda.reset_peak_memory_stats()
93
+ shared.mem_mon.monitor()
94
+ return {k: -(v//-(1024*1024)) for k, v in shared.mem_mon.stop().items()}
95
+
96
+
97
+ def run_benchmark(max_width, max_batch_count):
98
+ global curves
99
+ DEFAULT_ARGS = {
100
+ 'sd_model': shared.sd_model,
101
+ 'prompt': 'postapocalyptic steampunk city, exploration, cinematic, realistic, hyper detailed, photorealistic maximum detail, volumetric light, (((focus))), wide-angle, (((brightly lit))), (((vegetation))), lightning, vines, destruction, devastation, wartorn, ruins',
102
+ 'sampler_name': 'Euler a',
103
+ 'batch_size': 1,
104
+ 'n_iter': 1,
105
+ 'steps': 1,
106
+ 'cfg_scale': 15.0,
107
+ 'width': 512,
108
+ 'height': 512,
109
+ 'restore_faces': False,
110
+ 'tiling': False,
111
+ 'do_not_save_samples': True,
112
+ 'do_not_save_grid': True,
113
+ 'negative_prompt': '(((blurry))), ((foggy)), (((dark))), ((monochrome)), sun, (((depth of field)))',
114
+ 'do_not_reload_embeddings': True
115
+ }
116
+ results = {}
117
+
118
+ print("[VRAMEstimator] Starting benchmark...")
119
+ mem_stats = get_memory_stats()
120
+ base_active = mem_stats["active_peak"]
121
+ base_reserved = mem_stats["reserved_peak"]
122
+ base_used = mem_stats["total"] - mem_stats["free"]
123
+
124
+ shared.state.begin()
125
+ shared.state.job = "VRAM Estimator Benchmark"
126
+ shared.state.job_count = max_batch_count * int((max_width - 256) / 64)
127
+
128
+ for op in ["txt2img", "txt2img_hr", "txt2img_hr_latent", "img2img"]:
129
+ results[op] = []
130
+ for b in range(1, max_batch_count+1):
131
+ for i in range(256, max_width+64, 64):
132
+ #More verbose and informative progress strings
133
+ print(f"run benchmark:\nOperation: {op} \nBatch Count: {b}\nWidth: {i}")
134
+ devices.torch_gc()
135
+ torch.cuda.reset_peak_memory_stats()
136
+ shared.mem_mon.monitor()
137
+ shared.state.begin()
138
+
139
+ args = DEFAULT_ARGS.copy()
140
+ args["batch_size"] = b
141
+
142
+ if op == "txt2img":
143
+ args["width"] = i
144
+ args["height"] = i
145
+ p = StableDiffusionProcessingTxt2Img(**args)
146
+ elif op.startswith("txt2img_hr"):
147
+ args["width"] = int(i / 2)
148
+ args["height"] = int(i / 2)
149
+ args["enable_hr"] = True
150
+ args["hr_second_pass_steps"] = 1
151
+ args["hr_resize_x"] = i
152
+ args["hr_resize_y"] = i
153
+ if op == "txt2img_hr_latent":
154
+ args["hr_upscaler"] = "Latent"
155
+ else:
156
+ args["hr_upscaler"] = "Lanczos"
157
+ p = StableDiffusionProcessingTxt2Img(**args)
158
+ elif op == "img2img":
159
+ args["width"] = i
160
+ args["height"] = i
161
+ args["init_images"] = [Image.new("RGB", (512, 512))]
162
+ p = StableDiffusionProcessingImg2Img(**args)
163
+ else:
164
+ print(f'unknown operation: {op}')
165
+ return 'error'
166
+
167
+ t0 = time.time()
168
+ try:
169
+ process_images(p)
170
+ except Exception as e:
171
+ print(f'benchmark error: {e}')
172
+ shared.state.end()
173
+ break
174
+
175
+ t1 = time.time()
176
+ shared.state.end()
177
+
178
+ its = args["steps"] * args["batch_size"] / (t1 - t0)
179
+
180
+ mem_stats = {k: -(v//-(1024*1024)) for k, v in shared.mem_mon.stop().items()}
181
+ results[op].append({
182
+ "width": i,
183
+ "pixels": i * i,
184
+ "batch_size": args["batch_size"],
185
+ "active_peak": mem_stats["active_peak"] - base_active,
186
+ "reserved_peak": mem_stats["reserved_peak"] - base_reserved,
187
+ "sys_peak": mem_stats["system_peak"],
188
+ "sys_total": mem_stats["total"],
189
+ "its": round(its, 2)
190
+ })
191
+
192
+ with open(stats_file, "w", encoding="utf-8") as f:
193
+ json.dump(results, f)
194
+
195
+ del p
196
+ del args
197
+
198
+ curves = {}
199
+ for k, v in results.items():
200
+ curves[k] = VRAMCurve(v)
201
+
202
+ shared.state.end()
203
+ print("[VRAMEstimator] Benchmark finished.")
204
+
205
+ results = make_plots(results)
206
+ results.append("<span>Benchmark finished.</span>")
207
+ return results
208
+
209
+
210
+ def make_plots(results):
211
+ dfs = []
212
+
213
+ for op in ["txt2img", "txt2img_hr", "txt2img_hr_latent", "img2img"]:
214
+ x = []
215
+ y = []
216
+ z = []
217
+
218
+ for result in results[op]:
219
+ x.append(result["pixels"])
220
+ y.append(result["reserved_peak"])
221
+ z.append(result["batch_size"])
222
+
223
+ df = pd.DataFrame({"pixels": x, "reserved_peak": y, "batch_size": z})
224
+ dfs.append(df)
225
+
226
+ return dfs
227
+
228
+
229
+ def on_ui_tabs():
230
+ load_curve()
231
+
232
+ with gr.Blocks(analytics_enabled=False) as vram_estimator_tab:
233
+ with gr.Row():
234
+ plot = gr.LinePlot(title="txt2img Reserved VRAM", x="pixels", y="reserved_peak", color="batch_size", width=400, height=400, tooltip=["pixels", "reserved_peak", "batch_size"])
235
+ plot2 = gr.LinePlot(title="txt2img Highres Fix Reserved VRAM", x="pixels", y="reserved_peak", color="batch_size", width=400, height=400, tooltip=["pixels", "reserved_peak", "batch_size"])
236
+ with gr.Row():
237
+ plot3 = gr.LinePlot(title="txt2img Highres Fix (Latent) Reserved VRAM", x="pixels", y="reserved_peak", color="batch_size", width=400, height=400, tooltip=["pixels", "reserved_peak", "batch_size"])
238
+ plot4 = gr.LinePlot(title="img2img Reserved VRAM", x="pixels", y="reserved_peak", color="batch_size", width=400, height=400, tooltip=["pixels", "reserved_peak", "batch_size"])
239
+ with gr.Row():
240
+ width = gr.Slider(minimum=256, maximum=2048, step=64, label="Max Image Size", value=1024)
241
+ batch_count = gr.Slider(minimum=1, maximum=16, step=1, label="Max Batch Count", value=8)
242
+ with gr.Column():
243
+ bench_run_btn = gr.Button("Run benchmark", variant="primary").style(full_width=False)
244
+ load_results_button = gr.Button("Load results").style(full_width=False)
245
+ with gr.Row():
246
+ status = gr.HTML("")
247
+
248
+ bench_run_btn.click(run_benchmark, inputs=[width, batch_count], outputs=[plot, plot2, plot3, plot4, status])
249
+ load_results_button.click(load_curve, inputs=[], outputs=[plot, plot2, plot3, plot4])
250
+
251
+ return [(vram_estimator_tab, "VRAM Estimator", "vram_estimator_tab")]
252
+
253
+
254
+ heatmap = [
255
+ [-1.0, (0.2, 0.2, 1.0)],
256
+ [ 0.0, (0.2, 0.2, 1.0)],
257
+ [ 0.2, (0.0, 1.0, 1.0)],
258
+ [ 0.4, (0.0, 1.0, 0.0)],
259
+ [ 0.6, (1.0, 1.0, 0.0)],
260
+ [ 0.8, (1.0, 0.0, 0.0)],
261
+ [ 1.0, (1.0, 0.0, 0.8)],
262
+ [ 2.0, (1.0, 0.0, 0.8)],
263
+ ]
264
+
265
+
266
+ def gaussian(x, a, b, c, d=0):
267
+ return a * math.exp(-(x - b)**2 / (2 * c**2)) + d
268
+
269
+ def get_color(x, map=[], spread=1):
270
+ x = min(1.0, max(0, x))
271
+ r = min(1.0, sum([gaussian(x, p[1][0], p[0], 1.0 / (spread * len(map))) for p in map]))
272
+ g = min(1.0, sum([gaussian(x, p[1][1], p[0], 1.0 / (spread * len(map))) for p in map]))
273
+ b = min(1.0, sum([gaussian(x, p[1][2], p[0], 1.0 / (spread * len(map))) for p in map]))
274
+ return 'rgb(%.2f, %.2f, %.2f)' % (r * 255, g * 255, b * 255)
275
+
276
+
277
+ def make_span(reserved_vram_estimate):
278
+ if shared.state.job_count != 0:
279
+ return '<div style="padding: 10px"><span>(Currently generating...)</span></div>'
280
+
281
+ mem_stats = get_memory_stats()
282
+
283
+ # VRAM estimate is taken after used system VRAM is subtracted
284
+ base_rest = mem_stats["total"] - mem_stats["free"]
285
+ estimate_total = base_rest + reserved_vram_estimate * 1.1 # buffer
286
+
287
+ formatted_est = f"{round(estimate_total, 2):.2f} MB"
288
+ formatted_total = f"{mem_stats['total']} MB"
289
+ percent_usage = estimate_total / mem_stats['total']
290
+ color = get_color(percent_usage, map=heatmap, spread=1.5)
291
+
292
+ return f'''
293
+ <div style="padding: 10px">
294
+ <div>Estimated VRAM usage: <span style="color: {color}">{formatted_est} / {formatted_total} ({percent_usage * 100:.2f}%)</span></div>
295
+ <div>({base_rest} MB system + {reserved_vram_estimate:.2f} MB used)</div>
296
+ </div>
297
+ '''
298
+
299
+
300
+ def estimate_vram_txt2img(width, height, batch_size, enable_hr, hr_upscaler, hr_scale, hr_resize_x, hr_resize_y):
301
+ global curves
302
+ if "txt2img" not in curves or "txt2img_hr" not in curves:
303
+ return "<span>(No stats yet, run benchmark in VRAM Estimator tab)</span>"
304
+
305
+ final_width = width
306
+ final_height = height
307
+
308
+ if enable_hr:
309
+ if hr_resize_x == 0 and hr_resize_y == 0:
310
+ final_width = width * hr_scale
311
+ final_height = height * hr_scale
312
+ else:
313
+ if hr_resize_y == 0:
314
+ final_width = hr_resize_x
315
+ final_height = hr_resize_x * height // width
316
+ elif hr_resize_x == 0:
317
+ final_width = hr_resize_y * width // height
318
+ final_height = hr_resize_y
319
+ else:
320
+ src_ratio = width / height
321
+ dst_ratio = hr_resize_x / hr_resize_y
322
+
323
+ if src_ratio < dst_ratio:
324
+ final_width = hr_resize_x
325
+ final_height = hr_resize_x * height // width
326
+ else:
327
+ final_width = hr_resize_y * width // height
328
+ final_height = hr_resize_y
329
+
330
+ if hr_upscaler in shared.latent_upscale_modes:
331
+ upscaler_curve = "txt2img_hr_latent"
332
+ else:
333
+ upscaler_curve = "txt2img_hr"
334
+ print(hr_upscaler)
335
+ print(upscaler_curve)
336
+
337
+ vram_estimate_normal = curves["txt2img"].estimate(final_width * final_height, batch_size)
338
+ vram_estimate_hr = curves[upscaler_curve].estimate(final_width * final_height, batch_size)
339
+ vram_estimate = max(vram_estimate_normal, vram_estimate_hr)
340
+ else:
341
+ vram_estimate = curves["txt2img"].estimate(final_width * final_height, batch_size)
342
+
343
+ return make_span(vram_estimate)
344
+
345
+
346
+ def estimate_vram_img2img(width, height, batch_size):
347
+ global curves
348
+ if "img2img" not in curves:
349
+ return "<span>(No stats yet, run benchmark in VRAM Estimator tab)</span>"
350
+
351
+ vram_estimate = curves["img2img"].estimate(width * height, batch_size)
352
+ return make_span(vram_estimate)
353
+
354
+
355
+ class Script(scripts.Script):
356
+ def title(self):
357
+ return "VRAM Usage Estimator"
358
+
359
+ def show(self, is_img2img):
360
+ return scripts.AlwaysVisible
361
+
362
+ def ui(self, is_img2img):
363
+ with gr.Group():
364
+ with gr.Row():
365
+ vram_status = gr.HTML()
366
+
367
+ #Some extensions co-exist with vram estimator by throwing an error on load but nothing is wrong
368
+ try:
369
+ if is_img2img:
370
+ inputs = [self.i2i_width, self.i2i_height, self.i2i_batch_size]
371
+ fn = estimate_vram_img2img
372
+ else:
373
+ inputs = [self.t2i_width, self.t2i_height, self.t2i_batch_size, self.t2i_enable_hr, self.t2i_hr_upscaler, self.t2i_hr_scale, self.t2i_hr_resize_x, self.t2i_hr_resize_y]
374
+ fn = estimate_vram_txt2img
375
+
376
+
377
+ for input in inputs:
378
+ input.change(
379
+ fn=fn,
380
+ inputs=inputs,
381
+ outputs=[vram_status],
382
+ show_progress=False,
383
+ )
384
+ #So if it thinks something is wrong, we'll just tell it to carry on
385
+ except Exception as e:
386
+ return [vram_status]
387
+ return [vram_status]
388
+
389
+ def after_component(self, component, **kwargs):
390
+ elem_id = kwargs.get("elem_id")
391
+
392
+ if elem_id == "txt2img_width": self.t2i_width = component
393
+ elif elem_id == "txt2img_height": self.t2i_height = component
394
+ elif elem_id == "txt2img_batch_size": self.t2i_batch_size = component
395
+ elif elem_id == "txt2img_enable_hr": self.t2i_enable_hr = component
396
+ elif elem_id == "txt2img_hr_upscaler": self.t2i_hr_upscaler = component
397
+ elif elem_id == "txt2img_hr_scale": self.t2i_hr_scale = component
398
+ elif elem_id == "txt2img_hr_resize_x": self.t2i_hr_resize_x = component
399
+ elif elem_id == "txt2img_hr_resize_y": self.t2i_hr_resize_y = component
400
+ elif elem_id == "img2img_width": self.i2i_width = component
401
+ elif elem_id == "img2img_height": self.i2i_height = component
402
+ elif elem_id == "img2img_batch_size": self.i2i_batch_size = component
403
+
404
+
405
+ script_callbacks.on_ui_tabs(on_ui_tabs)
gf/a1111-stable-diffusion-webui-vram-estimator/static/preview.png ADDED
gf/asymmetric-tiling-sd-webui/.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ *.pyc
gf/asymmetric-tiling-sd-webui/LICENSE ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Creative Commons Legal Code
2
+
3
+ CC0 1.0 Universal
4
+
5
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12
+ HEREUNDER.
13
+
14
+ Statement of Purpose
15
+
16
+ The laws of most jurisdictions throughout the world automatically confer
17
+ exclusive Copyright and Related Rights (defined below) upon the creator
18
+ and subsequent owner(s) (each and all, an "owner") of an original work of
19
+ authorship and/or a database (each, a "Work").
20
+
21
+ Certain owners wish to permanently relinquish those rights to a Work for
22
+ the purpose of contributing to a commons of creative, cultural and
23
+ scientific works ("Commons") that the public can reliably and without fear
24
+ of later claims of infringement build upon, modify, incorporate in other
25
+ works, reuse and redistribute as freely as possible in any form whatsoever
26
+ and for any purposes, including without limitation commercial purposes.
27
+ These owners may contribute to the Commons to promote the ideal of a free
28
+ culture and the further production of creative, cultural and scientific
29
+ works, or to gain reputation or greater distribution for their Work in
30
+ part through the use and efforts of others.
31
+
32
+ For these and/or other purposes and motivations, and without any
33
+ expectation of additional consideration or compensation, the person
34
+ associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35
+ is an owner of Copyright and Related Rights in the Work, voluntarily
36
+ elects to apply CC0 to the Work and publicly distribute the Work under its
37
+ terms, with knowledge of his or her Copyright and Related Rights in the
38
+ Work and the meaning and intended legal effect of CC0 on those rights.
39
+
40
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
41
+ protected by copyright and related or neighboring rights ("Copyright and
42
+ Related Rights"). Copyright and Related Rights include, but are not
43
+ limited to, the following:
44
+
45
+ i. the right to reproduce, adapt, distribute, perform, display,
46
+ communicate, and translate a Work;
47
+ ii. moral rights retained by the original author(s) and/or performer(s);
48
+ iii. publicity and privacy rights pertaining to a person's image or
49
+ likeness depicted in a Work;
50
+ iv. rights protecting against unfair competition in regards to a Work,
51
+ subject to the limitations in paragraph 4(a), below;
52
+ v. rights protecting the extraction, dissemination, use and reuse of data
53
+ in a Work;
54
+ vi. database rights (such as those arising under Directive 96/9/EC of the
55
+ European Parliament and of the Council of 11 March 1996 on the legal
56
+ protection of databases, and under any national implementation
57
+ thereof, including any amended or successor version of such
58
+ directive); and
59
+ vii. other similar, equivalent or corresponding rights throughout the
60
+ world based on applicable law or treaty, and any national
61
+ implementations thereof.
62
+
63
+ 2. Waiver. To the greatest extent permitted by, but not in contravention
64
+ of, applicable law, Affirmer hereby overtly, fully, permanently,
65
+ irrevocably and unconditionally waives, abandons, and surrenders all of
66
+ Affirmer's Copyright and Related Rights and associated claims and causes
67
+ of action, whether now known or unknown (including existing as well as
68
+ future claims and causes of action), in the Work (i) in all territories
69
+ worldwide, (ii) for the maximum duration provided by applicable law or
70
+ treaty (including future time extensions), (iii) in any current or future
71
+ medium and for any number of copies, and (iv) for any purpose whatsoever,
72
+ including without limitation commercial, advertising or promotional
73
+ purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74
+ member of the public at large and to the detriment of Affirmer's heirs and
75
+ successors, fully intending that such Waiver shall not be subject to
76
+ revocation, rescission, cancellation, termination, or any other legal or
77
+ equitable action to disrupt the quiet enjoyment of the Work by the public
78
+ as contemplated by Affirmer's express Statement of Purpose.
79
+
80
+ 3. Public License Fallback. Should any part of the Waiver for any reason
81
+ be judged legally invalid or ineffective under applicable law, then the
82
+ Waiver shall be preserved to the maximum extent permitted taking into
83
+ account Affirmer's express Statement of Purpose. In addition, to the
84
+ extent the Waiver is so judged Affirmer hereby grants to each affected
85
+ person a royalty-free, non transferable, non sublicensable, non exclusive,
86
+ irrevocable and unconditional license to exercise Affirmer's Copyright and
87
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
88
+ maximum duration provided by applicable law or treaty (including future
89
+ time extensions), (iii) in any current or future medium and for any number
90
+ of copies, and (iv) for any purpose whatsoever, including without
91
+ limitation commercial, advertising or promotional purposes (the
92
+ "License"). The License shall be deemed effective as of the date CC0 was
93
+ applied by Affirmer to the Work. Should any part of the License for any
94
+ reason be judged legally invalid or ineffective under applicable law, such
95
+ partial invalidity or ineffectiveness shall not invalidate the remainder
96
+ of the License, and in such case Affirmer hereby affirms that he or she
97
+ will not (i) exercise any of his or her remaining Copyright and Related
98
+ Rights in the Work or (ii) assert any associated claims and causes of
99
+ action with respect to the Work, in either case contrary to Affirmer's
100
+ express Statement of Purpose.
101
+
102
+ 4. Limitations and Disclaimers.
103
+
104
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
105
+ surrendered, licensed or otherwise affected by this document.
106
+ b. Affirmer offers the Work as-is and makes no representations or
107
+ warranties of any kind concerning the Work, express, implied,
108
+ statutory or otherwise, including without limitation warranties of
109
+ title, merchantability, fitness for a particular purpose, non
110
+ infringement, or the absence of latent or other defects, accuracy, or
111
+ the present or absence of errors, whether or not discoverable, all to
112
+ the greatest extent permissible under applicable law.
113
+ c. Affirmer disclaims responsibility for clearing rights of other persons
114
+ that may apply to the Work or any use thereof, including without
115
+ limitation any person's Copyright and Related Rights in the Work.
116
+ Further, Affirmer disclaims responsibility for obtaining any necessary
117
+ consents, permissions or other rights required for any use of the
118
+ Work.
119
+ d. Affirmer understands and acknowledges that Creative Commons is not a
120
+ party to this document and has no duty or obligation with respect to
121
+ this CC0 or use of the Work.
gf/asymmetric-tiling-sd-webui/README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Asymmetric Tiling for stable-diffusion-webui
2
+
3
+ An always visible script extension for [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui/) to configure seamless image tiling independently for the X and Y axes.
4
+
5
+ To use, install this repository from the "Extensions" tab in stable-diffusion-webui, restart your server, open the `Asymmetric tiling` foldout on txt2img or img2img, and make it active, and check `Tile X` or `Tile Y` as desired. While this script is active, the `Tiling` checkbox in the main UI will be ignored.
6
+
7
+ Like existing tiling options this won't guarantee seamless tiling 100% of the time, but it should manage it for most prompts. You can check that images tile seamlessly using online tools like [Seamless Texture Check](https://www.pycheung.com/checker/).
8
+
9
+ For the old, non-extension version of this script, use the "classic_script" branch.
10
+
11
+ ## X axis tiling examples
12
+
13
+ ![00817-3274117678-midnight cityscape, stunning environment, wide-angle, massive scale, landscape, panoramic, lush vegetation, idyllic](https://user-images.githubusercontent.com/19196175/195132862-8c050327-92f3-44a4-9c02-0f11cce0b609.png)
14
+ ![01064-1316547214-(((domino run))), domino toppling, line of standing dominoes, domino cascade, domino effect, black dominos](https://user-images.githubusercontent.com/19196175/195137782-e72fc69a-14f1-4ae7-bac2-219734509aea.png)
15
+
16
+ ## Y Axis tiling examples
17
+
18
+ ![00840-2320166501-man climbing ladder, safety diagram](https://user-images.githubusercontent.com/19196175/195132867-1b36848e-135d-4103-8e10-1d760b3a0a4e.png)![01095-949590403-tree, thick branches, photograph, 80mm Sigma f1 4, studio quality, nature photography](https://user-images.githubusercontent.com/19196175/195140638-49b0a4be-fbca-45bc-8e52-6c985202ce29.png)
19
+
20
+ ## Update 2024/04/05
21
+
22
+ Support Forge (https://github.com/lllyasviel/stable-diffusion-webui-forge)
gf/asymmetric-tiling-sd-webui/scripts/__pycache__/asymmetric_tiling.cpython-310.pyc ADDED
Binary file (4.45 kB). View file
 
gf/asymmetric-tiling-sd-webui/scripts/asymmetric_tiling.py ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import typing as tg
2
+
3
+ import gradio as gr
4
+ from torch import Tensor
5
+ from torch.nn import Conv2d
6
+ from torch.nn import functional as F
7
+ from torch.nn.modules.utils import _pair
8
+
9
+ import modules.scripts
10
+ import modules.sd_hijack
11
+ import modules.shared
12
+
13
+ try:
14
+ from modules_forge.unet_patcher import UnetPatcher # type: ignore
15
+
16
+ IS_FORGE = True
17
+ except ImportError:
18
+ IS_FORGE = False
19
+
20
+
21
+ # Asymmetric tiling script for stable-diffusion-webui
22
+ #
23
+ # This script allows seamless tiling to be enabled separately for the X and Y axes.
24
+ # When this script is in use, the "Tiling" option in the regular UI is ignored.
25
+ class Script(modules.scripts.Script):
26
+ # Override from modules.scripts.Script
27
+ def title(self):
28
+ return "Asymmetric tiling"
29
+
30
+ # Override from modules.scripts.Script
31
+ def show(self, is_img2img):
32
+ return modules.scripts.AlwaysVisible
33
+
34
+ # Override from modules.scripts.Script
35
+ def ui(self, is_img2img):
36
+ with gr.Accordion("Asymmetric tiling", open=False):
37
+ active = gr.Checkbox(False, label="Active")
38
+ tileX = gr.Checkbox(True, label="Tile X")
39
+ tileY = gr.Checkbox(False, label="Tile Y")
40
+ startStep = gr.Number(0, label="Start tiling from step N", precision=0)
41
+ stopStep = gr.Number(-1, label="Stop tiling after step N (-1: Don't stop)", precision=0)
42
+
43
+ return [active, tileX, tileY, startStep, stopStep]
44
+
45
+ # Override from modules.scripts.Script
46
+ def process(self, p, active, tileX, tileY, startStep, stopStep):
47
+ if (active):
48
+ # Record tiling options chosen for each axis.
49
+ p.extra_generation_params = {
50
+ "Tile X": tileX,
51
+ "Tile Y": tileY,
52
+ "Start Tiling From Step": startStep,
53
+ "Stop Tiling After Step": stopStep,
54
+ }
55
+
56
+ # Modify the model's Conv2D layers to perform our chosen tiling.
57
+ if IS_FORGE:
58
+ unet_patcher = tg.cast(UnetPatcher, p.sd_model.forge_objects.unet).clone()
59
+ layers = [layer for layer in unet_patcher.model.modules() if isinstance(layer, Conv2d)]
60
+ self.__hijackConv2DMethods(layers, tileX, tileY, startStep, stopStep)
61
+ p.sd_model.forge_objects.unet = unet_patcher
62
+ else:
63
+ layers = [layer for layer in tg.cast(list, modules.sd_hijack.model_hijack.layers) if isinstance(layer, Conv2d)]
64
+ self.__hijackConv2DMethods(layers, tileX, tileY, startStep, stopStep)
65
+ else:
66
+ # Restore model behaviour to normal.
67
+ if IS_FORGE:
68
+ unet_patcher = tg.cast(UnetPatcher, p.sd_model.forge_objects.unet).clone()
69
+ layers = [layer for layer in unet_patcher.model.modules() if isinstance(layer, Conv2d)]
70
+ self.__restoreConv2DMethods(layers)
71
+ p.sd_model.forge_objects.unet = unet_patcher
72
+ else:
73
+ layers = [layer for layer in tg.cast(list, modules.sd_hijack.model_hijack.layers) if layer if isinstance(layer, Conv2d)]
74
+ self.__restoreConv2DMethods(layers)
75
+
76
+ def postprocess(self, *args):
77
+ # Restore model behaviour to normal.
78
+ if not IS_FORGE:
79
+ layers = [layer for layer in tg.cast(list, modules.sd_hijack.model_hijack.layers) if isinstance(layer, Conv2d)]
80
+ self.__restoreConv2DMethods(layers)
81
+
82
+ # [Private]
83
+ # Go through all the "Conv2D" layers in the model and patch them to use the requested asymmetric tiling mode.
84
+ def __hijackConv2DMethods(self, layers: list, tileX: bool, tileY: bool, startStep: int, stopStep: int):
85
+ for layer in layers:
86
+ layer.padding_modeX = 'circular' if tileX else 'constant'
87
+ layer.padding_modeY = 'circular' if tileY else 'constant'
88
+ layer.paddingX = (layer._reversed_padding_repeated_twice[0], layer._reversed_padding_repeated_twice[1], 0, 0)
89
+ layer.paddingY = (0, 0, layer._reversed_padding_repeated_twice[2], layer._reversed_padding_repeated_twice[3])
90
+ layer.paddingStartStep = startStep
91
+ layer.paddingStopStep = stopStep
92
+ layer._conv_forward = TilingConv2d.replacementConv2DConvForward.__get__(layer, Conv2d)
93
+
94
+ # [Private]
95
+ # Go through all the "Conv2D" layers in the model and restore them to their origanal behaviour.
96
+ def __restoreConv2DMethods(self, layers: list):
97
+ for layer in layers:
98
+ layer._conv_forward = Conv2d._conv_forward.__get__(layer, Conv2d)
99
+
100
+
101
+ class TilingConv2d(Conv2d):
102
+ # A replacement for the Conv2d._conv_forward method that pads axes asymmetrically.
103
+ # This replacement method performs the same operation (as of torch v1.12.1+cu113), but it pads the X and Y axes separately based on the members
104
+ # padding_modeX (string, either 'circular' or 'constant')
105
+ # padding_modeY (string, either 'circular' or 'constant')
106
+ # paddingX (tuple, cached copy of _reversed_padding_repeated_twice with the last two values zeroed)
107
+ # paddingY (tuple, cached copy of _reversed_padding_repeated_twice with the first two values zeroed)
108
+ def replacementConv2DConvForward(self, input: Tensor, weight: Tensor, bias: Tensor | None):
109
+ step = modules.shared.state.sampling_step
110
+ if ((self.paddingStartStep < 0 or step >= self.paddingStartStep) and (self.paddingStopStep < 0 or step <= self.paddingStopStep)):
111
+ working = F.pad(input, self.paddingX, mode=self.padding_modeX)
112
+ working = F.pad(working, self.paddingY, mode=self.padding_modeY)
113
+ else:
114
+ working = F.pad(input, self.paddingX, mode='constant')
115
+ working = F.pad(working, self.paddingY, mode='constant')
116
+ return F.conv2d(working, weight, bias, self.stride, _pair(0), self.dilation, self.groups)
gf/sd-webui-crop-extension/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+
2
+ *.pyc
gf/sd-webui-crop-extension/install.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import launch
2
+ # launch is imported in context of webui
3
+ if not launch.is_installed("dghs-imgutils") and not launch.is_installed("dghs-imgutils[gpu]"):
4
+ import torch.cuda as cuda
5
+ print("Installing dghs-imgutils")
6
+ launch.run_pip("install dghs-imgutils[gpu]" if cuda.is_available() else "install dghs-imgutils")
gf/sd-webui-crop-extension/scripts/__pycache__/ui.cpython-310.pyc ADDED
Binary file (1.43 kB). View file
 
gf/sd-webui-crop-extension/scripts/ui.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from modules import script_callbacks
2
+ import gradio as gr
3
+ from PIL import Image
4
+ import numpy as np
5
+ from imgutils.detect import detect_halfbody, detect_heads
6
+
7
+
8
+ def on_ui_tab_called():
9
+ with gr.Blocks() as transparent_interface:
10
+ with gr.Row():
11
+ with gr.Tabs():
12
+ with gr.TabItem("CropHead"):
13
+ image_upload_input = gr.Image(label="Upload Image", source="upload",type="pil")
14
+ button = gr.Button(label="Convert")
15
+ image_upload_output = gr.Image(label="Output Image",type="numpy")
16
+
17
+ def convert_image(image:Image.Image):
18
+ # first convert to RGB
19
+ if image.mode == "RGBA":
20
+ # convert transparent pixels to white
21
+ white_image = Image.new("RGB", image.size, (255, 255, 255))
22
+ white_image.paste(image, mask=image.split()[3])
23
+ image = white_image
24
+ else:
25
+ image = image.convert("RGB")
26
+ result = detect_heads(image)
27
+ new_image = image.crop(result[0][0])
28
+ return new_image # return the new image
29
+ button.click(convert_image, inputs=[image_upload_input], outputs=[image_upload_output])
30
+ return (transparent_interface, "CropHead", "script_crophead_interface"),
31
+
32
+ script_callbacks.on_ui_tabs(on_ui_tab_called)
gf/sd-webui-lua/.github/FUNDING.yml ADDED
@@ -0,0 +1 @@
 
 
1
+ ko_fi: Yownas
gf/sd-webui-lua/.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ __pycache__
gf/sd-webui-lua/LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
gf/sd-webui-lua/README.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # sd-webui-lua
2
+ Generate images with Lua scripts in Stable Diffusion webui.
3
+
4
+ This is an extension for [Vlad's SD.next](https://github.com/vladmandic/automatic/) and [automatic1111's stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) to let you run Lua code to generate images (and more?).
5
+
6
+ # Installation
7
+
8
+ Under `Extensions` go to `Manual install` and paste the link to this repository. Click `Install`.
9
+
10
+ # Usage
11
+
12
+ It too early to try writing some sort of proper guide. But all functions should be listed if you open up the "Lua Extras..." at the bottom, but the best way to get started is probably by looking in the `examples` folder and tinker with those. There are also some information in the wiki.
13
+
14
+ ![sd-webui-lua](https://github.com/yownas/sd-webui-lua/assets/13150150/f5bbd9f0-1519-4219-8ff0-a296c4ec1172)
15
+
16
+ # Why?
17
+
18
+ This project started as a joke, but quickly turned into a fun way to dig into and learn more about the code behind the webui. It also turned out
19
+ to be a fun tool to generate images in weird ways that normally isn't really possible through the webui. So, is this an amazing tool to help you
20
+ generate beautiful images? No. But it will probably be fun to play with if you know a little about how Stable Diffusion works, but not enough
21
+ to be comfortable to write your own code from scratch.
22
+
23
+ With this extension you can let the webui do the heavy lifting but still have access to poke at things on a fairly low level.
24
+
25
+ # Issues & todo
26
+
27
+ * Better css for the poor Code-box.
28
+
29
+ * Needs a lot more functions to manipulate/access things. (and a save button/function)
30
+
31
+ * Split sd.sample() into more parts.
32
+
33
+ * Maybe import the diffusers-library, but I'm not sure how to use that with ckpt/safetensors.
34
+
35
+ * More examples to show how things work. (Or actual documentation)
36
+
37
+ * More ideas. I'd rather have a PR than a vague Issue. But I'm happy for any input. :)
38
+
gf/sd-webui-lua/examples/basics/README_example.lua ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ -- This is the example in the README - Yownas
2
+
3
+ for i = 1, 12, 1 do
4
+ ui.status("Generating " .. input .. " #" .. i)
5
+ img = sd.process('a cute ' .. input)
6
+ ui.gallery.add(img)
7
+ end
8
+
9
+ return("Done...")
gf/sd-webui-lua/examples/basics/show_samplers.lua ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ -- Simple example on how to list available samplers - Yownas
2
+
3
+ -- To iterate over the list from python we'll use python.iter()
4
+
5
+ samplers = sd.getsamplers()
6
+
7
+ ui.out("Samplers:")
8
+ for name in python.iter(samplers) do
9
+ ui.out(name)
10
+ end
gf/sd-webui-lua/examples/basics/simple_output.lua ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- Simple output examples - Yownas
2
+
3
+ -- Clear Output box
4
+ ui.clear()
5
+
6
+ -- Add text to Output
7
+ ui.out("Adding text to Output with ui.out()")
8
+
9
+ -- These two have basically the same functionality
10
+ print("Using print()")
11
+ ui.console("Using ui.consol()")
12
+
13
+ -- Log
14
+ ui.log.info("Some information.")
15
+ ui.log.warning("A warning!")
16
+ ui.log.error("An error! Help!")
17
+
18
+ -- An optional return() will write to the Output box
19
+ a = 1
20
+ b = 2
21
+ return(a + b)