c83908758 commited on
Commit
062c4e3
·
verified ·
1 Parent(s): e5e834e

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +3 -3
  2. app.py +23 -23
README.md CHANGED
@@ -11,7 +11,7 @@ license: mit
11
 
12
  # wode
13
 
14
- Free lightweight image generation Space.
15
 
16
- Default model: `stabilityai/sd-turbo`
17
- Recommended settings on free CPU: 512x512, 1-4 steps.
 
11
 
12
  # wode
13
 
14
+ Free anime image generation Space.
15
 
16
+ Default model: `stablediffusionapi/counterfeit-v30`
17
+ Recommended settings on free CPU: 512x768, 16-24 steps, expect slow generations.
app.py CHANGED
@@ -6,36 +6,36 @@ import gradio as gr
6
  import torch
7
  from diffusers import AutoPipelineForText2Image
8
 
9
- MODEL_ID = os.getenv("MODEL_ID", "stabilityai/sd-turbo")
10
  DEFAULT_NEGATIVE = os.getenv(
11
  "DEFAULT_NEGATIVE",
12
- "blurry, lowres, worst quality, low quality, bad anatomy",
13
  )
14
 
15
  PRESETS = {
16
  "🌻 向日葵少女": {
17
  "prompt": "1girl, anime style, sunflower field, warm sunlight, soft lighting, detailed face, masterpiece, best quality",
18
  "negative": DEFAULT_NEGATIVE,
19
- "steps": 2,
20
- "cfg": 0.0,
21
  "width": 512,
22
- "height": 512,
23
  "seed": -1,
24
  },
25
  "🏙 赛博少女": {
26
  "prompt": "1girl, anime style, cyberpunk city, neon lights, night street, glowing signs, dynamic pose, masterpiece",
27
  "negative": DEFAULT_NEGATIVE,
28
- "steps": 2,
29
- "cfg": 0.0,
30
  "width": 512,
31
- "height": 512,
32
  "seed": -1,
33
  },
34
  "🌸 樱花和服": {
35
  "prompt": "1girl, anime style, kimono, cherry blossoms, spring, elegant pose, soft light, detailed illustration",
36
  "negative": DEFAULT_NEGATIVE,
37
- "steps": 2,
38
- "cfg": 0.0,
39
  "width": 512,
40
  "height": 768,
41
  "seed": -1,
@@ -43,8 +43,8 @@ PRESETS = {
43
  "⚔️ 幻想剑士": {
44
  "prompt": "anime warrior girl, fantasy armor, sword, dramatic lighting, wind, detailed background, masterpiece",
45
  "negative": DEFAULT_NEGATIVE,
46
- "steps": 2,
47
- "cfg": 0.0,
48
  "width": 512,
49
  "height": 768,
50
  "seed": -1,
@@ -126,22 +126,22 @@ def generate(
126
 
127
  with gr.Blocks(title="wode") as demo:
128
  gr.Markdown(
129
- f"# wode\n\n免费轻量版二次元生图\n\n当前模型:`{MODEL_ID}`\n\n建议参数:`512x512`、`1-4 steps`。免费档先求快再求细。"
130
  )
131
  with gr.Row():
132
  with gr.Column():
133
  prompt = gr.Textbox(
134
  label="正向提示词",
135
  lines=4,
136
- placeholder="例如:1girl, anime style, sunflower field, warm sunlight, masterpiece",
137
  )
138
  negative_prompt = gr.Textbox(label="反向提示词", lines=2, value=DEFAULT_NEGATIVE)
139
  with gr.Row():
140
- steps = gr.Slider(1, 8, value=2, step=1, label="步数 Steps")
141
- guidance_scale = gr.Slider(0, 5, value=0.0, step=0.5, label="引导强度 CFG")
142
  with gr.Row():
143
  width = gr.Slider(256, 768, value=512, step=64, label="宽度")
144
- height = gr.Slider(256, 768, value=512, step=64, label="高度")
145
  seed = gr.Number(label="随机种子(-1 为随机)", value=-1, precision=0)
146
  with gr.Row():
147
  run = gr.Button("开始生成", variant="primary")
@@ -174,19 +174,19 @@ with gr.Blocks(title="wode") as demo:
174
  [
175
  PRESETS["🌻 向日葵少女"]["prompt"],
176
  DEFAULT_NEGATIVE,
177
- 2,
178
- 0.0,
179
- 512,
180
  512,
 
181
  -1,
182
  ],
183
  [
184
  PRESETS["🏙 赛博少女"]["prompt"],
185
  DEFAULT_NEGATIVE,
186
- 2,
187
- 0.0,
188
- 512,
189
  512,
 
190
  -1,
191
  ],
192
  ],
 
6
  import torch
7
  from diffusers import AutoPipelineForText2Image
8
 
9
+ MODEL_ID = os.getenv("MODEL_ID", "stablediffusionapi/counterfeit-v30")
10
  DEFAULT_NEGATIVE = os.getenv(
11
  "DEFAULT_NEGATIVE",
12
+ "blurry, lowres, worst quality, low quality, bad anatomy, watermark, text, extra fingers",
13
  )
14
 
15
  PRESETS = {
16
  "🌻 向日葵少女": {
17
  "prompt": "1girl, anime style, sunflower field, warm sunlight, soft lighting, detailed face, masterpiece, best quality",
18
  "negative": DEFAULT_NEGATIVE,
19
+ "steps": 18,
20
+ "cfg": 7.0,
21
  "width": 512,
22
+ "height": 768,
23
  "seed": -1,
24
  },
25
  "🏙 赛博少女": {
26
  "prompt": "1girl, anime style, cyberpunk city, neon lights, night street, glowing signs, dynamic pose, masterpiece",
27
  "negative": DEFAULT_NEGATIVE,
28
+ "steps": 18,
29
+ "cfg": 7.0,
30
  "width": 512,
31
+ "height": 768,
32
  "seed": -1,
33
  },
34
  "🌸 樱花和服": {
35
  "prompt": "1girl, anime style, kimono, cherry blossoms, spring, elegant pose, soft light, detailed illustration",
36
  "negative": DEFAULT_NEGATIVE,
37
+ "steps": 20,
38
+ "cfg": 7.0,
39
  "width": 512,
40
  "height": 768,
41
  "seed": -1,
 
43
  "⚔️ 幻想剑士": {
44
  "prompt": "anime warrior girl, fantasy armor, sword, dramatic lighting, wind, detailed background, masterpiece",
45
  "negative": DEFAULT_NEGATIVE,
46
+ "steps": 20,
47
+ "cfg": 7.0,
48
  "width": 512,
49
  "height": 768,
50
  "seed": -1,
 
126
 
127
  with gr.Blocks(title="wode") as demo:
128
  gr.Markdown(
129
+ f"# wode\n\n免费二次元生图(已切到 Counterfeit 路线)\n\n当前模型:`{MODEL_ID}`\n\n建议参数:`512x768`、`16-24 steps`、`CFG 6-8`\n\n⚠️ 免费 CPU 很慢首张图等 `1~3 分钟` 都正常。"
130
  )
131
  with gr.Row():
132
  with gr.Column():
133
  prompt = gr.Textbox(
134
  label="正向提示词",
135
  lines=4,
136
+ placeholder="例如:1girl, anime style, detailed face, masterpiece, best quality",
137
  )
138
  negative_prompt = gr.Textbox(label="反向提示词", lines=2, value=DEFAULT_NEGATIVE)
139
  with gr.Row():
140
+ steps = gr.Slider(8, 32, value=20, step=1, label="步数 Steps")
141
+ guidance_scale = gr.Slider(1, 12, value=7.0, step=0.5, label="引导强度 CFG")
142
  with gr.Row():
143
  width = gr.Slider(256, 768, value=512, step=64, label="宽度")
144
+ height = gr.Slider(256, 1024, value=768, step=64, label="高度")
145
  seed = gr.Number(label="随机种子(-1 为随机)", value=-1, precision=0)
146
  with gr.Row():
147
  run = gr.Button("开始生成", variant="primary")
 
174
  [
175
  PRESETS["🌻 向日葵少女"]["prompt"],
176
  DEFAULT_NEGATIVE,
177
+ 18,
178
+ 7.0,
 
179
  512,
180
+ 768,
181
  -1,
182
  ],
183
  [
184
  PRESETS["🏙 赛博少女"]["prompt"],
185
  DEFAULT_NEGATIVE,
186
+ 18,
187
+ 7.0,
 
188
  512,
189
+ 768,
190
  -1,
191
  ],
192
  ],