Spaces:
Sleeping
Sleeping
Diese Pull Request macht jede Generation anders
Browse filesJede Generation ist anders.
Klicken Sie auf „Zusammenführen“, um diese Funktion hinzuzufügen.
Each generation becomes different.
Click on _Merge_ to add this feature.
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import spaces
|
|
|
|
| 2 |
import torch
|
| 3 |
import torchaudio
|
| 4 |
from einops import rearrange
|
|
@@ -22,6 +23,10 @@ if os.environ.get("HUGGING_FACE_HUB_TOKEN"):
|
|
| 22 |
@spaces.GPU(duration=300)
|
| 23 |
def generate_audio(prompt, duration=10, steps=50, cfg_scale=7):
|
| 24 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 26 |
|
| 27 |
# Modell laden und zum Gerät verschieben
|
|
|
|
| 1 |
import spaces
|
| 2 |
+
import random
|
| 3 |
import torch
|
| 4 |
import torchaudio
|
| 5 |
from einops import rearrange
|
|
|
|
| 23 |
@spaces.GPU(duration=300)
|
| 24 |
def generate_audio(prompt, duration=10, steps=50, cfg_scale=7):
|
| 25 |
try:
|
| 26 |
+
seed = random.randint(0, 2**63 - 1)
|
| 27 |
+
random.seed(seed)
|
| 28 |
+
torch.manual_seed(seed)
|
| 29 |
+
|
| 30 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 31 |
|
| 32 |
# Modell laden und zum Gerät verschieben
|