CrazyEric commited on
Commit
00325e0
1 Parent(s): a1777e8
Files changed (1) hide show
  1. app.py +31 -31
app.py CHANGED
@@ -12,7 +12,7 @@ import spaces
12
  import torch
13
  from diffusers import AutoencoderKL, DiffusionPipeline
14
 
15
- DESCRIPTION = "# SDXL"
16
  if not torch.cuda.is_available():
17
  DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"
18
 
@@ -130,8 +130,8 @@ def generate(
130
 
131
 
132
  examples = [
133
- "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
134
- "An astronaut riding a green horse",
135
  ]
136
 
137
  with gr.Blocks(css="style.css") as demo:
@@ -144,72 +144,72 @@ with gr.Blocks(css="style.css") as demo:
144
  with gr.Group():
145
  with gr.Row():
146
  prompt = gr.Text(
147
- label="Prompt",
148
  show_label=False,
149
  max_lines=1,
150
- placeholder="Enter your prompt",
151
  container=False,
152
  )
153
- run_button = gr.Button("Run", scale=0)
154
- result = gr.Image(label="Result", show_label=False)
155
- with gr.Accordion("Advanced options", open=False):
156
  with gr.Row():
157
- use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=False)
158
- use_prompt_2 = gr.Checkbox(label="Use prompt 2", value=False)
159
- use_negative_prompt_2 = gr.Checkbox(label="Use negative prompt 2", value=False)
160
  negative_prompt = gr.Text(
161
- label="Negative prompt",
162
  max_lines=1,
163
- placeholder="Enter a negative prompt",
164
  visible=False,
165
  )
166
  prompt_2 = gr.Text(
167
- label="Prompt 2",
168
  max_lines=1,
169
- placeholder="Enter your prompt",
170
  visible=False,
171
- )
172
  negative_prompt_2 = gr.Text(
173
- label="Negative prompt 2",
 
174
  max_lines=1,
175
- placeholder="Enter a negative prompt",
176
  visible=False,
177
  )
178
 
179
  seed = gr.Slider(
180
- label="Seed",
181
  minimum=0,
182
  maximum=MAX_SEED,
183
  step=1,
184
  value=0,
185
  )
186
- randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
187
  with gr.Row():
188
  width = gr.Slider(
189
- label="Width",
190
  minimum=256,
191
  maximum=MAX_IMAGE_SIZE,
192
  step=32,
193
- value=1024,
194
  )
195
  height = gr.Slider(
196
- label="Height",
197
  minimum=256,
198
  maximum=MAX_IMAGE_SIZE,
199
  step=32,
200
  value=1024,
201
  )
202
- apply_refiner = gr.Checkbox(label="Apply refiner", value=False, visible=ENABLE_REFINER)
203
  with gr.Row():
204
  guidance_scale_base = gr.Slider(
205
- label="Guidance scale for base",
206
  minimum=1,
207
  maximum=20,
208
  step=0.1,
209
- value=5.0,
210
  )
211
  num_inference_steps_base = gr.Slider(
212
- label="Number of inference steps for base",
213
  minimum=10,
214
  maximum=100,
215
  step=1,
@@ -217,14 +217,14 @@ with gr.Blocks(css="style.css") as demo:
217
  )
218
  with gr.Row(visible=False) as refiner_params:
219
  guidance_scale_refiner = gr.Slider(
220
- label="Guidance scale for refiner",
221
  minimum=1,
222
  maximum=20,
223
  step=0.1,
224
- value=5.0,
225
  )
226
  num_inference_steps_refiner = gr.Slider(
227
- label="Number of inference steps for refiner",
228
  minimum=10,
229
  maximum=100,
230
  step=1,
@@ -305,4 +305,4 @@ with gr.Blocks(css="style.css") as demo:
305
  )
306
 
307
  if __name__ == "__main__":
308
- demo.queue(max_size=20).launch()
 
12
  import torch
13
  from diffusers import AutoencoderKL, DiffusionPipeline
14
 
15
+ DESCRIPTION = "# AI 作画"
16
  if not torch.cuda.is_available():
17
  DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"
18
 
 
130
 
131
 
132
  examples = [
133
+ "宇航员在丛林中,冷色调,柔和的色彩,细节,8k",
134
+ "一只熊猫戴着草帽,在湖面上划船,电影风格,4K",
135
  ]
136
 
137
  with gr.Blocks(css="style.css") as demo:
 
144
  with gr.Group():
145
  with gr.Row():
146
  prompt = gr.Text(
147
+ label="提示词",
148
  show_label=False,
149
  max_lines=1,
150
+ placeholder="输入要生成的画面内容",
151
  container=False,
152
  )
153
+ run_button = gr.Button("生成", scale=0)
154
+ result = gr.Image(label="生成结果", show_label=False)
155
+ with gr.Accordion("高级选项", open=False):
156
  with gr.Row():
157
+ use_negative_prompt = gr.Checkbox(label="使用反向提示词", value=False)
158
+ use_prompt_2 = gr.Checkbox(label="使用提示词 2", value=False)
159
+ use_negative_prompt_2 = gr.Checkbox(label="使用反向提示词 2", value=False)
160
  negative_prompt = gr.Text(
161
+ label="反向提示词",
162
  max_lines=1,
163
+ placeholder="输入不想在画面中出现的内容,比如:“胡子”,“人群”",
164
  visible=False,
165
  )
166
  prompt_2 = gr.Text(
167
+ label="提示词 2",
168
  max_lines=1,
169
+ placeholder="输入你的提示词",
170
  visible=False,
 
171
  negative_prompt_2 = gr.Text(
172
+ )
173
+ label="反向提示词 2",
174
  max_lines=1,
175
+ placeholder="输入你的反向提示词",
176
  visible=False,
177
  )
178
 
179
  seed = gr.Slider(
180
+ label="种子数",
181
  minimum=0,
182
  maximum=MAX_SEED,
183
  step=1,
184
  value=0,
185
  )
186
+ randomize_seed = gr.Checkbox(label="随机种子数", value=True)
187
  with gr.Row():
188
  width = gr.Slider(
189
+ label="",
190
  minimum=256,
191
  maximum=MAX_IMAGE_SIZE,
192
  step=32,
193
+ value=736,
194
  )
195
  height = gr.Slider(
196
+ label="",
197
  minimum=256,
198
  maximum=MAX_IMAGE_SIZE,
199
  step=32,
200
  value=1024,
201
  )
202
+ apply_refiner = gr.Checkbox(label="增加精炼模型(refiner", value=False, visible=ENABLE_REFINER)
203
  with gr.Row():
204
  guidance_scale_base = gr.Slider(
205
+ label="提示词相关性",
206
  minimum=1,
207
  maximum=20,
208
  step=0.1,
209
+ value=7.5,
210
  )
211
  num_inference_steps_base = gr.Slider(
212
+ label="模型迭代步数",
213
  minimum=10,
214
  maximum=100,
215
  step=1,
 
217
  )
218
  with gr.Row(visible=False) as refiner_params:
219
  guidance_scale_refiner = gr.Slider(
220
+ label="提示词相关性(refiner",
221
  minimum=1,
222
  maximum=20,
223
  step=0.1,
224
+ value=7.5,
225
  )
226
  num_inference_steps_refiner = gr.Slider(
227
+ label="模型迭代步数(refiner",
228
  minimum=10,
229
  maximum=100,
230
  step=1,
 
305
  )
306
 
307
  if __name__ == "__main__":
308
+ demo.queue(max_size=30).launch()