Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,10 +14,10 @@ vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
|
|
14 |
|
15 |
speaker_embeddings = {
|
16 |
"BDL": "spkemb/triniFemale.npy",
|
17 |
-
"CLB": "spkemb/triniFemale.npy",
|
18 |
-
"KSP": "spkemb/triniFemale.npy",
|
19 |
-
"RMS": "spkemb/triniFemale.npy",
|
20 |
-
"SLT": "spkemb/triniFemale.npy",
|
21 |
}
|
22 |
|
23 |
|
@@ -53,7 +53,7 @@ def predict(text, speaker):
|
|
53 |
speaker_embedding = torch.tensor(speaker_embedding) #the saved model is already unsqueezed, but is not a tensor, so make it one
|
54 |
speech = model.generate_speech(input_ids, speaker_embedding, vocoder=vocoder)
|
55 |
|
56 |
-
speech = (speech.numpy() * 32767).astype(np.int16)
|
57 |
return (16000, speech)
|
58 |
|
59 |
|
@@ -98,14 +98,14 @@ article = """
|
|
98 |
</div>
|
99 |
"""
|
100 |
|
101 |
-
examples = [
|
102 |
-
["It is not in the stars to hold our destiny but in ourselves.", "BDL (male)"],
|
103 |
-
["The octopus and Oliver went to the opera in October.", "CLB (female)"],
|
104 |
-
["She sells seashells by the seashore. I saw a kitten eating chicken in the kitchen.", "RMS (male)"],
|
105 |
-
["Brisk brave brigadiers brandished broad bright blades, blunderbusses, and bludgeons—balancing them badly.", "SLT (female)"],
|
106 |
-
["A synonym for cinnamon is a cinnamon synonym.", "BDL (male)"],
|
107 |
-
["How much wood would a woodchuck chuck if a woodchuck could chuck wood? He would chuck, he would, as much as he could, and chuck as much wood as a woodchuck would if a woodchuck could chuck wood.", "CLB (female)"],
|
108 |
-
]
|
109 |
|
110 |
gr.Interface(
|
111 |
fn=predict,
|
@@ -127,5 +127,5 @@ gr.Interface(
|
|
127 |
title=title,
|
128 |
description=description,
|
129 |
article=article,
|
130 |
-
|
131 |
).launch()
|
|
|
14 |
|
15 |
speaker_embeddings = {
|
16 |
"BDL": "spkemb/triniFemale.npy",
|
17 |
+
#"CLB": "spkemb/triniFemale.npy",
|
18 |
+
#"KSP": "spkemb/triniFemale.npy",
|
19 |
+
#"RMS": "spkemb/triniFemale.npy",
|
20 |
+
#"SLT": "spkemb/triniFemale.npy",
|
21 |
}
|
22 |
|
23 |
|
|
|
53 |
speaker_embedding = torch.tensor(speaker_embedding) #the saved model is already unsqueezed, but is not a tensor, so make it one
|
54 |
speech = model.generate_speech(input_ids, speaker_embedding, vocoder=vocoder)
|
55 |
|
56 |
+
#speech = (speech.numpy() * 32767).astype(np.int16)
|
57 |
return (16000, speech)
|
58 |
|
59 |
|
|
|
98 |
</div>
|
99 |
"""
|
100 |
|
101 |
+
#examples = [ \
|
102 |
+
#["It is not in the stars to hold our destiny but in ourselves.", "BDL (male)"],
|
103 |
+
#["The octopus and Oliver went to the opera in October.", "CLB (female)"],
|
104 |
+
#["She sells seashells by the seashore. I saw a kitten eating chicken in the kitchen.", "RMS (male)"],
|
105 |
+
#["Brisk brave brigadiers brandished broad bright blades, blunderbusses, and bludgeons—balancing them badly.", "SLT (female)"],
|
106 |
+
#["A synonym for cinnamon is a cinnamon synonym.", "BDL (male)"],
|
107 |
+
#["How much wood would a woodchuck chuck if a woodchuck could chuck wood? He would chuck, he would, as much as he could, and chuck as much wood as a woodchuck would if a woodchuck could chuck wood.", "CLB (female)"],
|
108 |
+
#]
|
109 |
|
110 |
gr.Interface(
|
111 |
fn=predict,
|
|
|
127 |
title=title,
|
128 |
description=description,
|
129 |
article=article,
|
130 |
+
# examples=examples,
|
131 |
).launch()
|