Spaces:
Runtime error
Runtime error
Commit
•
3ae15ab
1
Parent(s):
18a451e
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ num_rows = 3
|
|
6 |
num_cols = 3
|
7 |
num_images = num_rows * num_cols
|
8 |
image_size = 64
|
9 |
-
plot_image_size =
|
10 |
|
11 |
model = hf_hub.from_pretrained_keras("beresandras/denoising-diffusion-model")
|
12 |
|
@@ -46,7 +46,10 @@ def generate_images(diffusion_steps, stochasticity, min_signal_rate, max_signal_
|
|
46 |
)
|
47 |
|
48 |
# denormalize
|
49 |
-
|
|
|
|
|
|
|
50 |
|
51 |
# make grid
|
52 |
generated_images = tf.image.resize(generated_images, (plot_image_size, plot_image_size), method="nearest")
|
|
|
6 |
num_cols = 3
|
7 |
num_images = num_rows * num_cols
|
8 |
image_size = 64
|
9 |
+
plot_image_size = 64
|
10 |
|
11 |
model = hf_hub.from_pretrained_keras("beresandras/denoising-diffusion-model")
|
12 |
|
|
|
46 |
)
|
47 |
|
48 |
# denormalize
|
49 |
+
data_mean = tf.constant([[[[0.4704 0.3942 0.3033]]]])
|
50 |
+
data_variance = tf.constant([[[[0.08366 0.05590 0.07183]]]])
|
51 |
+
generated_images = data_mean + pred_images * data_variance ** 0.5
|
52 |
+
generated_images = tf.clip_by_value(pred_images, 0.0, 1.0)
|
53 |
|
54 |
# make grid
|
55 |
generated_images = tf.image.resize(generated_images, (plot_image_size, plot_image_size), method="nearest")
|