This PR makes each generation different
Browse filesEach generation becomes different.
Click on _Merge_ to add this feature.
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import torch
|
2 |
import torchaudio
|
3 |
from einops import rearrange
|
@@ -26,6 +27,11 @@ def generate_audio(prompt, seconds_total=10, steps=100, cfg_scale=7):
|
|
26 |
print(f"Prompt received: {prompt}")
|
27 |
print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
30 |
print(f"Using device: {device}")
|
31 |
|
|
|
1 |
+
import random
|
2 |
import torch
|
3 |
import torchaudio
|
4 |
from einops import rearrange
|
|
|
27 |
print(f"Prompt received: {prompt}")
|
28 |
print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
|
29 |
|
30 |
+
seed = random.randint(0, 2**63 - 1)
|
31 |
+
random.seed(seed)
|
32 |
+
torch.manual_seed(seed)
|
33 |
+
print(f"Using seed: {seed}")
|
34 |
+
|
35 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
36 |
print(f"Using device: {device}")
|
37 |
|