Spaces:
Running
on
Zero
Running
on
Zero
Update app_diffusers.py
Browse files- app_diffusers.py +2 -0
app_diffusers.py
CHANGED
|
@@ -30,6 +30,7 @@ pipe.to("cuda")
|
|
| 30 |
@spaces.GPU(duration=75)
|
| 31 |
def generate(prompt, img_height=1024, img_width=1024, seed=42, steps=50, guidance_scale=5.0):
|
| 32 |
print(f'inference with prompt : {prompt}, size: {img_height}x{img_width}, seed : {seed}, step : {steps}, cfg : {guidance_scale}')
|
|
|
|
| 33 |
image = pipe(
|
| 34 |
prompt,
|
| 35 |
negative_prompt="",
|
|
@@ -37,6 +38,7 @@ def generate(prompt, img_height=1024, img_width=1024, seed=42, steps=50, guidanc
|
|
| 37 |
width=img_width,
|
| 38 |
num_inference_steps=steps,
|
| 39 |
true_cfg_scale=guidance_scale,
|
|
|
|
| 40 |
).images[0]
|
| 41 |
return image
|
| 42 |
|
|
|
|
| 30 |
@spaces.GPU(duration=75)
|
| 31 |
def generate(prompt, img_height=1024, img_width=1024, seed=42, steps=50, guidance_scale=5.0):
|
| 32 |
print(f'inference with prompt : {prompt}, size: {img_height}x{img_width}, seed : {seed}, step : {steps}, cfg : {guidance_scale}')
|
| 33 |
+
generator = torch.Generator().manual_seed(seed)
|
| 34 |
image = pipe(
|
| 35 |
prompt,
|
| 36 |
negative_prompt="",
|
|
|
|
| 38 |
width=img_width,
|
| 39 |
num_inference_steps=steps,
|
| 40 |
true_cfg_scale=guidance_scale,
|
| 41 |
+
generator=generator,
|
| 42 |
).images[0]
|
| 43 |
return image
|
| 44 |
|