Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,25 +38,40 @@ pipe.enable_attention_slicing()
|
|
| 38 |
# )
|
| 39 |
|
| 40 |
pipe.unet.load_attn_procs(
|
| 41 |
-
|
| 42 |
-
weight_name="pytorch_custom_diffusion_weights.bin"
|
| 43 |
)
|
| 44 |
|
| 45 |
print("Pipeline loaded")
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
def generate(prompt, steps, guidance):
|
| 48 |
|
| 49 |
print("Generating...")
|
| 50 |
-
|
| 51 |
-
|
| 52 |
prompt,
|
| 53 |
-
num_inference_steps=steps,
|
| 54 |
-
guidance_scale=guidance
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
-
print("Done")
|
| 59 |
-
|
| 60 |
return image
|
| 61 |
|
| 62 |
|
|
|
|
| 38 |
# )
|
| 39 |
|
| 40 |
pipe.unet.load_attn_procs(
|
| 41 |
+
"./pytorch_custom_diffusion_weights.bin"
|
|
|
|
| 42 |
)
|
| 43 |
|
| 44 |
print("Pipeline loaded")
|
| 45 |
|
| 46 |
+
# def generate(prompt, steps, guidance):
|
| 47 |
+
|
| 48 |
+
# print("Generating...")
|
| 49 |
+
|
| 50 |
+
# image = pipe(
|
| 51 |
+
# prompt,
|
| 52 |
+
# num_inference_steps=steps,
|
| 53 |
+
# guidance_scale=guidance,
|
| 54 |
+
# eta=1
|
| 55 |
+
# ).images[0]
|
| 56 |
+
|
| 57 |
+
# print("Done")
|
| 58 |
+
|
| 59 |
+
# return image
|
| 60 |
+
|
| 61 |
def generate(prompt, steps, guidance):
|
| 62 |
|
| 63 |
print("Generating...")
|
| 64 |
+
|
| 65 |
+
result = pipe(
|
| 66 |
prompt,
|
| 67 |
+
num_inference_steps=int(steps),
|
| 68 |
+
guidance_scale=float(guidance)
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
print("RESULT:", result)
|
| 72 |
+
|
| 73 |
+
image = result.images[0]
|
| 74 |
|
|
|
|
|
|
|
| 75 |
return image
|
| 76 |
|
| 77 |
|