Spaces:
Sleeping
Sleeping
This Pull Request makes a different audio for each run
Browse filesEach generation becomes different, even for the same prompt.
Click on _Merge_ to add this feature.
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import spaces
|
| 2 |
import os
|
| 3 |
import uuid
|
|
@@ -39,6 +40,10 @@ model.to(device,torch.float32)
|
|
| 39 |
def generate_audio(prompt, seconds_total=30, steps=100, cfg_scale=7, use_bfloat=False, use_eval=False):
|
| 40 |
print(f"Prompt received: {prompt}")
|
| 41 |
print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
sample_rate = model_config["sample_rate"]
|
| 43 |
sample_size = model_config["sample_size"]
|
| 44 |
print(f"Sample rate: {sample_rate}, Sample size: {sample_size}")
|
|
|
|
| 1 |
+
import random
|
| 2 |
import spaces
|
| 3 |
import os
|
| 4 |
import uuid
|
|
|
|
| 40 |
def generate_audio(prompt, seconds_total=30, steps=100, cfg_scale=7, use_bfloat=False, use_eval=False):
|
| 41 |
print(f"Prompt received: {prompt}")
|
| 42 |
print(f"Settings: Duration={seconds_total}s, Steps={steps}, CFG Scale={cfg_scale}")
|
| 43 |
+
seed = random.randint(0, 2**63 - 1)
|
| 44 |
+
random.seed(seed)
|
| 45 |
+
torch.manual_seed(seed)
|
| 46 |
+
print(f"Using seed: {seed}")
|
| 47 |
sample_rate = model_config["sample_rate"]
|
| 48 |
sample_size = model_config["sample_size"]
|
| 49 |
print(f"Sample rate: {sample_rate}, Sample size: {sample_size}")
|