Spaces:
Runtime error
Runtime error
This PR makes each generation different
#12
by
Fabrice-TIERCELIN
- opened
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import torch
|
| 2 |
import torchaudio
|
| 3 |
from einops import rearrange
|
|
@@ -30,6 +31,11 @@ def generate_audio(prompt, sampler_type_dropdown, seconds_total=30, steps=100, c
|
|
| 30 |
print(f"Prompt received: {prompt}")
|
| 31 |
print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 34 |
print(f"Using device: {device}")
|
| 35 |
|
|
|
|
| 1 |
+
import random
|
| 2 |
import torch
|
| 3 |
import torchaudio
|
| 4 |
from einops import rearrange
|
|
|
|
| 31 |
print(f"Prompt received: {prompt}")
|
| 32 |
print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
|
| 33 |
|
| 34 |
+
seed = random.randint(0, 2**63 - 1)
|
| 35 |
+
random.seed(seed)
|
| 36 |
+
torch.manual_seed(seed)
|
| 37 |
+
print(f"Using seed: {seed}")
|
| 38 |
+
|
| 39 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 40 |
print(f"Using device: {device}")
|
| 41 |
|