Spaces:
Runtime error
Runtime error
Update utils_app.py
Browse files- utils_app.py +15 -16
utils_app.py
CHANGED
@@ -28,23 +28,22 @@ def keras_stable_diffusion(
|
|
28 |
width:int,
|
29 |
):
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
img_height=width
|
37 |
-
)
|
38 |
-
|
39 |
-
db_diffusion_model = from_pretrained_keras(model_path)
|
40 |
-
sd_dreambooth_model._diffusion_model = db_diffusion_model
|
41 |
-
|
42 |
-
generated_images = sd_dreambooth_model.text_to_image(
|
43 |
-
prompt=prompt,
|
44 |
-
negative_prompt=negative_prompt,
|
45 |
-
num_steps=num_inference_step,
|
46 |
-
unconditional_guidance_scale=guidance_scale
|
47 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
return generated_images
|
50 |
|
|
|
28 |
width:int,
|
29 |
):
|
30 |
|
31 |
+
keras.mixed_precision.set_global_policy("mixed_float16")
|
32 |
+
|
33 |
+
sd_dreambooth_model = models.StableDiffusion(
|
34 |
+
img_width=height,
|
35 |
+
img_height=width
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
)
|
37 |
+
|
38 |
+
db_diffusion_model = from_pretrained_keras(model_path)
|
39 |
+
sd_dreambooth_model._diffusion_model = db_diffusion_model
|
40 |
+
|
41 |
+
generated_images = sd_dreambooth_model.text_to_image(
|
42 |
+
prompt=prompt,
|
43 |
+
negative_prompt=negative_prompt,
|
44 |
+
num_steps=num_inference_step,
|
45 |
+
unconditional_guidance_scale=guidance_scale
|
46 |
+
)
|
47 |
|
48 |
return generated_images
|
49 |
|