Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
5d635cf
1
Parent(s):
c0963a6
add inference
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import spaces #[uncomment to use ZeroGPU]
|
|
| 6 |
from diffusers import (
|
| 7 |
AutoencoderKL,
|
| 8 |
StableDiffusionXLPipeline,
|
|
|
|
| 9 |
)
|
| 10 |
from huggingface_hub import login, hf_hub_download
|
| 11 |
from PIL import Image
|
|
@@ -241,10 +242,16 @@ def infer(
|
|
| 241 |
|
| 242 |
# Generate image with selected steps
|
| 243 |
image_quick = generate_image_with_steps(prompt, negative_prompt, seed, width, height, guidance_scale, num_inference_steps)
|
| 244 |
-
|
| 245 |
# Generate image with 50 steps for high quality
|
| 246 |
-
|
| 247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
return image_quick, image_50_steps, seed
|
| 249 |
|
| 250 |
|
|
|
|
| 6 |
from diffusers import (
|
| 7 |
AutoencoderKL,
|
| 8 |
StableDiffusionXLPipeline,
|
| 9 |
+
DPMSolverMultistepScheduler
|
| 10 |
)
|
| 11 |
from huggingface_hub import login, hf_hub_download
|
| 12 |
from PIL import Image
|
|
|
|
| 242 |
|
| 243 |
# Generate image with selected steps
|
| 244 |
image_quick = generate_image_with_steps(prompt, negative_prompt, seed, width, height, guidance_scale, num_inference_steps)
|
| 245 |
+
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, final_sigmas_type="sigma_min")
|
| 246 |
# Generate image with 50 steps for high quality
|
| 247 |
+
negative_prompts = '(worst quality:2), (low quality:2), (normal quality:2), bad anatomy, bad proportions, poorly drawn face, poorly drawn hands, missing fingers, extra limbs, blurry, pixelated, distorted, lowres, jpeg artifacts, watermark, signature, text, (deformed:1.5), (bad hands:1.3), overexposed, underexposed, censored, mutated, extra fingers, cloned face, bad eyes'
|
| 248 |
+
negative_prompts = 1 * [negative_prompts]
|
| 249 |
+
image_50_steps = pipe(prompt=[prompt]
|
| 250 |
+
,negative_prompt=negative_prompts
|
| 251 |
+
,num_inference_steps=20
|
| 252 |
+
,guidance_scale=guidance_scale
|
| 253 |
+
,height=height
|
| 254 |
+
,width=width).images
|
| 255 |
return image_quick, image_50_steps, seed
|
| 256 |
|
| 257 |
|