Spaces:
Runtime error
Runtime error
Commit
·
404e08e
1
Parent(s):
e26b705
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ num_images = num_rows * num_cols
|
|
8 |
image_size = 64
|
9 |
plot_image_size = 256
|
10 |
|
11 |
-
model = hf_hub.from_pretrained_keras("beresandras/denoising-diffusion-
|
12 |
|
13 |
def diffusion_schedule(diffusion_times, min_signal_rate, max_signal_rate):
|
14 |
start_angle = tf.acos(max_signal_rate)
|
@@ -37,8 +37,7 @@ def generate_images(diffusion_steps, stochasticity, min_signal_rate, max_signal_
|
|
37 |
sample_noises = tf.random.normal(shape=(num_images, image_size, image_size, 3))
|
38 |
sample_noise_rates = stochasticity * (1.0 - (signal_rates / next_signal_rates)**2)**0.5 * (next_noise_rates / noise_rates)
|
39 |
|
40 |
-
pred_noises = model([noisy_images, noise_rates])
|
41 |
-
pred_images = (noisy_images - noise_rates * pred_noises) / signal_rates
|
42 |
noisy_images = (
|
43 |
next_signal_rates * pred_images
|
44 |
+ (next_noise_rates**2 - sample_noise_rates**2)**0.5 * pred_noises
|
|
|
8 |
image_size = 64
|
9 |
plot_image_size = 256
|
10 |
|
11 |
+
model = hf_hub.from_pretrained_keras("beresandras/denoising-diffusion-models")
|
12 |
|
13 |
def diffusion_schedule(diffusion_times, min_signal_rate, max_signal_rate):
|
14 |
start_angle = tf.acos(max_signal_rate)
|
|
|
37 |
sample_noises = tf.random.normal(shape=(num_images, image_size, image_size, 3))
|
38 |
sample_noise_rates = stochasticity * (1.0 - (signal_rates / next_signal_rates)**2)**0.5 * (next_noise_rates / noise_rates)
|
39 |
|
40 |
+
pred_noises, pred_images = model([noisy_images, noise_rates, signal_rates])
|
|
|
41 |
noisy_images = (
|
42 |
next_signal_rates * pred_images
|
43 |
+ (next_noise_rates**2 - sample_noise_rates**2)**0.5 * pred_noises
|