Update app.py
Browse files
app.py
CHANGED
@@ -42,16 +42,14 @@ import librosa
|
|
42 |
|
43 |
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
# set_seed(42)
|
55 |
# Load model directly
|
56 |
from transformers import AutoProcessor, AutoModelForTextToSpectrogram
|
57 |
|
@@ -128,7 +126,7 @@ def tts_fn(slider_value, input_text):
|
|
128 |
inputs = processor(text = text, return_tensors="pt")
|
129 |
|
130 |
with torch.no_grad():
|
131 |
-
spectrogram = model.generate_speech(inputs["input_ids"], speaker_embedding, minlenratio = 2, maxlenratio = 4, threshold = 0.
|
132 |
|
133 |
with torch.no_grad():
|
134 |
speech = vocoder(spectrogram)
|
|
|
42 |
|
43 |
|
44 |
|
45 |
+
def set_seed(seed):
|
46 |
+
torch.manual_seed(seed)
|
47 |
+
if torch.cuda.is_available():
|
48 |
+
torch.cuda.manual_seed_all(seed)
|
49 |
+
np.random.seed(seed)
|
50 |
+
torch.backends.cudnn.benchmark = False
|
51 |
+
|
52 |
+
set_seed(997)
|
|
|
|
|
53 |
# Load model directly
|
54 |
from transformers import AutoProcessor, AutoModelForTextToSpectrogram
|
55 |
|
|
|
126 |
inputs = processor(text = text, return_tensors="pt")
|
127 |
|
128 |
with torch.no_grad():
|
129 |
+
spectrogram = model.generate_speech(inputs["input_ids"], speaker_embedding, minlenratio = 2, maxlenratio = 4, threshold = 0.4)
|
130 |
|
131 |
with torch.no_grad():
|
132 |
speech = vocoder(spectrogram)
|