Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ import logging
|
|
7 |
import sys
|
8 |
import re
|
9 |
from logging.handlers import TimedRotatingFileHandler
|
|
|
10 |
|
11 |
app = Flask(__name__)
|
12 |
|
@@ -20,7 +21,7 @@ class RequestFormatter(logging.Formatter):
|
|
20 |
return None
|
21 |
|
22 |
formatter = RequestFormatter(
|
23 |
-
'%(remote_addr)s - - [%(asctime)s] %(message)s',
|
24 |
datefmt='%d/%b/%Y %H:%M:%S'
|
25 |
)
|
26 |
|
@@ -33,22 +34,14 @@ app.logger.setLevel(logging.INFO)
|
|
33 |
|
34 |
SYSTEM_ASSISTANT = """作为 Stable Diffusion Prompt 提示词专家,您将从关键词中创建提示,通常来自 Danbooru 等数据库。
|
35 |
提示通常描述图像,使用常见词汇,按重要性排列,并用逗号分隔。避免使用"-"或".",但可以接受空格和自然语言。避免词汇重复。
|
36 |
-
|
37 |
为了强调关键词,请将其放在括号中以增加其权重。例如,"(flowers)"将'flowers'的权重增加1.1倍,而"(((flowers)))"将其增加1.331倍。使用"(flowers:1.5)"将'flowers'的权重增加1.5倍。只为重要的标签增加权重。
|
38 |
-
|
39 |
提示包括三个部分:**前缀** (质量标签+风格词+效果器)+ **主题** (图像的主要焦点)+ **场景** (背景、环境)。
|
40 |
-
|
41 |
* 前缀影响图像质量。像"masterpiece"、"best quality"、"4k"这样的标签可以提高图像的细节。像"illustration"、"lensflare"这样的风格词定义图像的风格。像"bestlighting"、"lensflare"、"depthoffield"这样的效果器会影响光照和深度。
|
42 |
-
|
43 |
* 主题是图像的主要焦点,如角色或场景。对主题进行详细描述可以确保图像丰富而详细。增加主题的权重以增强其清晰度。对于角色,描述面部、头发、身体、服装、姿势等特征。
|
44 |
-
|
45 |
* 场景描述环境。没有场景,图像的背景是平淡的,主题显得过大。某些主题本身包含场景(例如建筑物、风景)。像"花草草地"、"阳光"、"河流"这样的环境词可以丰富场景。你的任务是设计图像生成的提示。请按照以下步骤进行操作:
|
46 |
-
|
47 |
1. 我会发送给您一个图像场景。需要你生成详细的图像描述
|
48 |
2. 图像描述必须是英文,输出为Positive Prompt。
|
49 |
-
|
50 |
示例:
|
51 |
-
|
52 |
我发送:二战时期的护士。
|
53 |
您回复只回复:
|
54 |
A WWII-era nurse in a German uniform, holding a wine bottle and stethoscope, sitting at a table in white attire, with a table in the background, masterpiece, best quality, 4k, illustration style, best lighting, depth of field, detailed character, detailed environment.
|
@@ -138,7 +131,6 @@ def index():
|
|
138 |
</ul>
|
139 |
</li>
|
140 |
</ol>
|
141 |
-
|
142 |
<h2>Example Request:</h2>
|
143 |
<pre><code>
|
144 |
{
|
@@ -151,7 +143,6 @@ def index():
|
|
151 |
]
|
152 |
}
|
153 |
</code></pre>
|
154 |
-
|
155 |
<p>For more details, please refer to the API documentation.</p>
|
156 |
</body>
|
157 |
</html>
|
|
|
7 |
import sys
|
8 |
import re
|
9 |
from logging.handlers import TimedRotatingFileHandler
|
10 |
+
from datetime import datetime
|
11 |
|
12 |
app = Flask(__name__)
|
13 |
|
|
|
21 |
return None
|
22 |
|
23 |
formatter = RequestFormatter(
|
24 |
+
'%(remote_addr)s - - [%(asctime)s] - %(message)s',
|
25 |
datefmt='%d/%b/%Y %H:%M:%S'
|
26 |
)
|
27 |
|
|
|
34 |
|
35 |
SYSTEM_ASSISTANT = """作为 Stable Diffusion Prompt 提示词专家,您将从关键词中创建提示,通常来自 Danbooru 等数据库。
|
36 |
提示通常描述图像,使用常见词汇,按重要性排列,并用逗号分隔。避免使用"-"或".",但可以接受空格和自然语言。避免词汇重复。
|
|
|
37 |
为了强调关键词,请将其放在括号中以增加其权重。例如,"(flowers)"将'flowers'的权重增加1.1倍,而"(((flowers)))"将其增加1.331倍。使用"(flowers:1.5)"将'flowers'的权重增加1.5倍。只为重要的标签增加权重。
|
|
|
38 |
提示包括三个部分:**前缀** (质量标签+风格词+效果器)+ **主题** (图像的主要焦点)+ **场景** (背景、环境)。
|
|
|
39 |
* 前缀影响图像质量。像"masterpiece"、"best quality"、"4k"这样的标签可以提高图像的细节。像"illustration"、"lensflare"这样的风格词定义图像的风格。像"bestlighting"、"lensflare"、"depthoffield"这样的效果器会影响光照和深度。
|
|
|
40 |
* 主题是图像的主要焦点,如角色或场景。对主题进行详细描述可以确保图像丰富而详细。增加主题的权重以增强其清晰度。对于角色,描述面部、头发、身体、服装、姿势等特征。
|
|
|
41 |
* 场景描述环境。没有场景,图像的背景是平淡的,主题显得过大。某些主题本身包含场景(例如建筑物、风景)。像"花草草地"、"阳光"、"河流"这样的环境词可以丰富场景。你的任务是设计图像生成的提示。请按照以下步骤进行操作:
|
|
|
42 |
1. 我会发送给您一个图像场景。需要你生成详细的图像描述
|
43 |
2. 图像描述必须是英文,输出为Positive Prompt。
|
|
|
44 |
示例:
|
|
|
45 |
我发送:二战时期的护士。
|
46 |
您回复只回复:
|
47 |
A WWII-era nurse in a German uniform, holding a wine bottle and stethoscope, sitting at a table in white attire, with a table in the background, masterpiece, best quality, 4k, illustration style, best lighting, depth of field, detailed character, detailed environment.
|
|
|
131 |
</ul>
|
132 |
</li>
|
133 |
</ol>
|
|
|
134 |
<h2>Example Request:</h2>
|
135 |
<pre><code>
|
136 |
{
|
|
|
143 |
]
|
144 |
}
|
145 |
</code></pre>
|
|
|
146 |
<p>For more details, please refer to the API documentation.</p>
|
147 |
</body>
|
148 |
</html>
|