Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -108,10 +108,10 @@ def generate(
|
|
108 |
|
109 |
if not apply_refiner:
|
110 |
return pipe(
|
111 |
-
prompt=prompt,
|
112 |
-
negative_prompt=negative_prompt,
|
113 |
-
prompt_2=prompt_2,
|
114 |
-
negative_prompt_2=negative_prompt_2,
|
115 |
width=width,
|
116 |
height=height,
|
117 |
guidance_scale=guidance_scale_base,
|
@@ -121,10 +121,10 @@ def generate(
|
|
121 |
).images[0]
|
122 |
else:
|
123 |
latents = pipe(
|
124 |
-
prompt=prompt,
|
125 |
-
negative_prompt=negative_prompt,
|
126 |
-
prompt_2=prompt_2,
|
127 |
-
negative_prompt_2=negative_prompt_2,
|
128 |
width=width,
|
129 |
height=height,
|
130 |
guidance_scale=guidance_scale_base,
|
@@ -133,10 +133,10 @@ def generate(
|
|
133 |
output_type="latent",
|
134 |
).images
|
135 |
image = refiner(
|
136 |
-
prompt=prompt,
|
137 |
-
negative_prompt=negative_prompt,
|
138 |
-
prompt_2=prompt_2,
|
139 |
-
negative_prompt_2=negative_prompt_2,
|
140 |
guidance_scale=guidance_scale_refiner,
|
141 |
num_inference_steps=num_inference_steps_refiner,
|
142 |
image=latents,
|
@@ -159,13 +159,13 @@ with gr.Blocks(css="style.css") as demo:
|
|
159 |
)
|
160 |
with gr.Group():
|
161 |
with gr.Row():
|
162 |
-
prompt =
|
163 |
label="提示词",
|
164 |
show_label=False,
|
165 |
max_lines=1,
|
166 |
placeholder="输入要生成的画面内容",
|
167 |
container=False,
|
168 |
-
)
|
169 |
run_button = gr.Button("生成", scale=0)
|
170 |
result = gr.Image(label="生成结果", show_label=False)
|
171 |
with gr.Accordion("高级选项", open=False):
|
@@ -173,24 +173,24 @@ with gr.Blocks(css="style.css") as demo:
|
|
173 |
use_negative_prompt = gr.Checkbox(label="使用反向提示词", value=False)
|
174 |
use_prompt_2 = gr.Checkbox(label="使用提示词 2", value=False)
|
175 |
use_negative_prompt_2 = gr.Checkbox(label="使用反向提示词 2", value=False)
|
176 |
-
negative_prompt =
|
177 |
label="反向提示词",
|
178 |
max_lines=1,
|
179 |
placeholder="输入不想在画面中出现的内容,比如:“胡子”,“人群”",
|
180 |
visible=False,
|
181 |
-
)
|
182 |
-
prompt_2 =
|
183 |
label="提示词 2",
|
184 |
max_lines=1,
|
185 |
placeholder="输入你的提示词",
|
186 |
visible=False,
|
187 |
-
)
|
188 |
-
negative_prompt_2 =
|
189 |
label="反向提示词 2",
|
190 |
max_lines=1,
|
191 |
placeholder="输入你的反向提示词",
|
192 |
visible=False,
|
193 |
-
)
|
194 |
|
195 |
seed = gr.Slider(
|
196 |
label="种子数",
|
|
|
108 |
|
109 |
if not apply_refiner:
|
110 |
return pipe(
|
111 |
+
prompt=process_text(prompt),
|
112 |
+
negative_prompt=process_text(negative_prompt),
|
113 |
+
prompt_2=process_text(prompt_2),
|
114 |
+
negative_prompt_2=process_text(negative_prompt_2),
|
115 |
width=width,
|
116 |
height=height,
|
117 |
guidance_scale=guidance_scale_base,
|
|
|
121 |
).images[0]
|
122 |
else:
|
123 |
latents = pipe(
|
124 |
+
prompt=process_text(prompt),
|
125 |
+
negative_prompt=process_text(negative_prompt),
|
126 |
+
prompt_2=process_text(prompt_2),
|
127 |
+
negative_prompt_2=process_text(negative_prompt_2),
|
128 |
width=width,
|
129 |
height=height,
|
130 |
guidance_scale=guidance_scale_base,
|
|
|
133 |
output_type="latent",
|
134 |
).images
|
135 |
image = refiner(
|
136 |
+
prompt=process_text(prompt),
|
137 |
+
negative_prompt=process_text(negative_prompt),
|
138 |
+
prompt_2=process_text(prompt_2),
|
139 |
+
negative_prompt_2=process_text(negative_prompt_2),
|
140 |
guidance_scale=guidance_scale_refiner,
|
141 |
num_inference_steps=num_inference_steps_refiner,
|
142 |
image=latents,
|
|
|
159 |
)
|
160 |
with gr.Group():
|
161 |
with gr.Row():
|
162 |
+
prompt = gr.Text(
|
163 |
label="提示词",
|
164 |
show_label=False,
|
165 |
max_lines=1,
|
166 |
placeholder="输入要生成的画面内容",
|
167 |
container=False,
|
168 |
+
)
|
169 |
run_button = gr.Button("生成", scale=0)
|
170 |
result = gr.Image(label="生成结果", show_label=False)
|
171 |
with gr.Accordion("高级选项", open=False):
|
|
|
173 |
use_negative_prompt = gr.Checkbox(label="使用反向提示词", value=False)
|
174 |
use_prompt_2 = gr.Checkbox(label="使用提示词 2", value=False)
|
175 |
use_negative_prompt_2 = gr.Checkbox(label="使用反向提示词 2", value=False)
|
176 |
+
negative_prompt = gr.Text(
|
177 |
label="反向提示词",
|
178 |
max_lines=1,
|
179 |
placeholder="输入不想在画面中出现的内容,比如:“胡子”,“人群”",
|
180 |
visible=False,
|
181 |
+
)
|
182 |
+
prompt_2 = gr.Text(
|
183 |
label="提示词 2",
|
184 |
max_lines=1,
|
185 |
placeholder="输入你的提示词",
|
186 |
visible=False,
|
187 |
+
)
|
188 |
+
negative_prompt_2 = gr.Text(
|
189 |
label="反向提示词 2",
|
190 |
max_lines=1,
|
191 |
placeholder="输入你的反向提示词",
|
192 |
visible=False,
|
193 |
+
)
|
194 |
|
195 |
seed = gr.Slider(
|
196 |
label="种子数",
|