Fabrice-TIERCELIN commited on
Commit
aa6965f
·
verified ·
1 Parent(s): cfd828f

This PR makes each generation different

Browse files

Each generation becomes different.

Click on _Merge_ to add this feature.

Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import torch
2
  import torchaudio
3
  from einops import rearrange
@@ -23,6 +24,11 @@ def generate_audio(prompt, seconds_total=30, steps=100, cfg_scale=7):
23
  print(f"Prompt received: {prompt}")
24
  print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
25
 
 
 
 
 
 
26
  device = "cuda" if torch.cuda.is_available() else "cpu"
27
  print(f"Using device: {device}")
28
 
 
1
+ import random
2
  import torch
3
  import torchaudio
4
  from einops import rearrange
 
24
  print(f"Prompt received: {prompt}")
25
  print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
26
 
27
+ seed = random.randint(0, 2**63 - 1)
28
+ random.seed(seed)
29
+ torch.manual_seed(seed)
30
+ print(f"Using seed: {seed}")
31
+
32
  device = "cuda" if torch.cuda.is_available() else "cpu"
33
  print(f"Using device: {device}")
34