Spaces:
Runtime error
Runtime error
modify strength
Browse files
beat_interpolator.py
CHANGED
|
@@ -60,14 +60,14 @@ def beat_interpolator(wave_path, generator, latent_dim, seed, fps=30, batch_size
|
|
| 60 |
times2 = np.asarray(times)
|
| 61 |
times = merge_times(times, times2)
|
| 62 |
|
| 63 |
-
times = np.concatenate([np.asarray([0.]), times], 0)
|
| 64 |
times = list(np.unique(np.int64(np.floor(times * fps / 2))) * 2)
|
| 65 |
|
| 66 |
latents = []
|
| 67 |
time0 = 0
|
| 68 |
latent0 = rng.randn(latent_dim)
|
| 69 |
for time1 in times:
|
| 70 |
-
latent1 = rng.randn(latent_dim)
|
| 71 |
db_cur_index = np.argmin(np.abs(db_times - time1.astype('float32') / fps))
|
| 72 |
db_cur = db[db_cur_index]
|
| 73 |
if db_cur < db_min + (db_mean - db_min) / 3:
|
|
@@ -83,7 +83,7 @@ def beat_interpolator(wave_path, generator, latent_dim, seed, fps=30, batch_size
|
|
| 83 |
if time1 > duration * fps:
|
| 84 |
time1 = int(duration * fps)
|
| 85 |
t1 = time1 - time0
|
| 86 |
-
alpha = 0.5
|
| 87 |
latent2 = latent0 * alpha + latent1 * (1 - alpha)
|
| 88 |
for j in range(t1):
|
| 89 |
alpha = j / t1
|
|
|
|
| 60 |
times2 = np.asarray(times)
|
| 61 |
times = merge_times(times, times2)
|
| 62 |
|
| 63 |
+
times = np.concatenate([np.asarray([0.]), times, duration], 0)
|
| 64 |
times = list(np.unique(np.int64(np.floor(times * fps / 2))) * 2)
|
| 65 |
|
| 66 |
latents = []
|
| 67 |
time0 = 0
|
| 68 |
latent0 = rng.randn(latent_dim)
|
| 69 |
for time1 in times:
|
| 70 |
+
latent1 = latent0 * (1 - strength) + rng.randn(latent_dim) * strength
|
| 71 |
db_cur_index = np.argmin(np.abs(db_times - time1.astype('float32') / fps))
|
| 72 |
db_cur = db[db_cur_index]
|
| 73 |
if db_cur < db_min + (db_mean - db_min) / 3:
|
|
|
|
| 83 |
if time1 > duration * fps:
|
| 84 |
time1 = int(duration * fps)
|
| 85 |
t1 = time1 - time0
|
| 86 |
+
alpha = 0.5
|
| 87 |
latent2 = latent0 * alpha + latent1 * (1 - alpha)
|
| 88 |
for j in range(t1):
|
| 89 |
alpha = j / t1
|
examples/models/anime_biggan/model.py
CHANGED
|
@@ -430,7 +430,7 @@ def create_anime_biggan_inference():
|
|
| 430 |
'generator': anime_biggan_generator,
|
| 431 |
'latent_dim': anime_biggan.z_dim,
|
| 432 |
'fps': 5,
|
| 433 |
-
'batch_size':
|
| 434 |
'strength': 0.45,
|
| 435 |
'max_duration': 15,
|
| 436 |
'use_peak': True
|
|
|
|
| 430 |
'generator': anime_biggan_generator,
|
| 431 |
'latent_dim': anime_biggan.z_dim,
|
| 432 |
'fps': 5,
|
| 433 |
+
'batch_size': 2,
|
| 434 |
'strength': 0.45,
|
| 435 |
'max_duration': 15,
|
| 436 |
'use_peak': True
|