Spaces:
Paused
Paused
alan
commited on
Commit
·
9be89be
1
Parent(s):
fe1f10a
update
Browse files
app.py
CHANGED
|
@@ -35,6 +35,12 @@ with open('ja_sentences.txt') as f:
|
|
| 35 |
####################################
|
| 36 |
# Constants
|
| 37 |
####################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
AVAILABLE_MODELS = {
|
| 39 |
# 'XTTSv2': 'xtts',
|
| 40 |
# # 'WhisperSpeech': 'whisperspeech',
|
|
@@ -51,10 +57,10 @@ AVAILABLE_MODELS = {
|
|
| 51 |
# 'Parler TTS': 'parler'
|
| 52 |
'MOE-VITS': 'moe-vits',
|
| 53 |
'BARK': 'bark',
|
| 54 |
-
'KOTOBA-SPEECH-
|
| 55 |
-
'KOTOBA-SPEECH-
|
| 56 |
-
'KOTOBA-SPEECH-
|
| 57 |
-
'KOTOBA-SPEECH-
|
| 58 |
'BLANE-TTS': 'blane-tts',
|
| 59 |
'AMITARO-VITS': 'amitaro-vits',
|
| 60 |
'GOOGLE-TTS': 'google-tts',
|
|
@@ -124,56 +130,56 @@ def get_db():
|
|
| 124 |
|
| 125 |
def get_tts_file(text: str, model: str):
|
| 126 |
url = {
|
| 127 |
-
"kotoba-speech-
|
| 128 |
-
"kotoba-speech-
|
| 129 |
-
"kotoba-speech-
|
| 130 |
-
"kotoba-speech-
|
| 131 |
"blane-tts": "https://blane187-blane-tts.hf.space/call/get_audio_file"
|
| 132 |
}
|
| 133 |
headers = {
|
| 134 |
"Content-Type": "application/json"
|
| 135 |
}
|
| 136 |
data = {
|
| 137 |
-
"kotoba-speech-
|
| 138 |
"data": [
|
| 139 |
text,
|
| 140 |
5,
|
| 141 |
5,
|
| 142 |
"Preset voices",
|
| 143 |
-
|
| 144 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"},
|
| 145 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"}
|
| 146 |
]
|
| 147 |
},
|
| 148 |
-
"kotoba-speech-
|
| 149 |
"data": [
|
| 150 |
text,
|
| 151 |
5,
|
| 152 |
5,
|
| 153 |
"Preset voices",
|
| 154 |
-
|
| 155 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"},
|
| 156 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"}
|
| 157 |
]
|
| 158 |
},
|
| 159 |
-
"kotoba-speech-
|
| 160 |
"data": [
|
| 161 |
text,
|
| 162 |
5,
|
| 163 |
5,
|
| 164 |
"Preset voices",
|
| 165 |
-
|
| 166 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"},
|
| 167 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"}
|
| 168 |
]
|
| 169 |
},
|
| 170 |
-
"kotoba-speech-
|
| 171 |
"data": [
|
| 172 |
text,
|
| 173 |
5,
|
| 174 |
5,
|
| 175 |
"Preset voices",
|
| 176 |
-
|
| 177 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"},
|
| 178 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"}
|
| 179 |
]
|
|
@@ -392,10 +398,10 @@ model_names = {
|
|
| 392 |
# 'metavoice': 'MetaVoice-1B',
|
| 393 |
'BARK': 'BARK',
|
| 394 |
'MOE-VITS': 'MOE-VITS',
|
| 395 |
-
'KOTOBA-SPEECH-
|
| 396 |
-
'KOTOBA-SPEECH-
|
| 397 |
-
'KOTOBA-SPEECH-
|
| 398 |
-
'KOTOBA-SPEECH-
|
| 399 |
'BLANE-TTS': 'BLANE-TTS',
|
| 400 |
'AMITARO-VITS': 'AMITARO-VITS',
|
| 401 |
'GOOGLE-TTS': 'GOOGLE-TTS',
|
|
@@ -450,10 +456,10 @@ model_links = {
|
|
| 450 |
# 'metavoice': 'https://github.com/metavoiceio/metavoice-src',
|
| 451 |
'bark': 'https://suno-bark.hf.space/',
|
| 452 |
'moe-vits': 'skytnt/moe-tts',
|
| 453 |
-
'kotoba-speech-
|
| 454 |
-
'kotoba-speech-
|
| 455 |
-
'kotoba-speech-
|
| 456 |
-
'kotoba-speech-
|
| 457 |
'blane-tts': 'https://blane187-blane-tts.hf.space/',
|
| 458 |
'amitaro-vits': 'https://lycoris53-vits-tts-japanese-only-amitaro.hf.space/'
|
| 459 |
}
|
|
|
|
| 35 |
####################################
|
| 36 |
# Constants
|
| 37 |
####################################
|
| 38 |
+
|
| 39 |
+
SPK1 = os.getenv('KOTOBA_SPK1')
|
| 40 |
+
SPK2 = os.getenv('KOTOBA_SPK2')
|
| 41 |
+
SPK3 = os.getenv('KOTOBA_SPK3')
|
| 42 |
+
SPK4 = os.getenv('KOTOBA_SPK4')
|
| 43 |
+
|
| 44 |
AVAILABLE_MODELS = {
|
| 45 |
# 'XTTSv2': 'xtts',
|
| 46 |
# # 'WhisperSpeech': 'whisperspeech',
|
|
|
|
| 57 |
# 'Parler TTS': 'parler'
|
| 58 |
'MOE-VITS': 'moe-vits',
|
| 59 |
'BARK': 'bark',
|
| 60 |
+
f'KOTOBA-SPEECH-{SPK1.upper()}': f'kotoba-speech-{SPK1.lower()}',
|
| 61 |
+
f'KOTOBA-SPEECH-{SPK2.upper()}': f'kotoba-speech-{SPK2.lower()}',
|
| 62 |
+
f'KOTOBA-SPEECH-{SPK3.upper()}': f'kotoba-speech-{SPK3.lower()}',
|
| 63 |
+
f'KOTOBA-SPEECH-{SPK4.upper()}': f'kotoba-speech-{SPK4.lower()}',
|
| 64 |
'BLANE-TTS': 'blane-tts',
|
| 65 |
'AMITARO-VITS': 'amitaro-vits',
|
| 66 |
'GOOGLE-TTS': 'google-tts',
|
|
|
|
| 130 |
|
| 131 |
def get_tts_file(text: str, model: str):
|
| 132 |
url = {
|
| 133 |
+
f"kotoba-speech-{SPK1.lower()}": "https://kotoba-tech-kotoba-speech.hf.space/call/tts",
|
| 134 |
+
f"kotoba-speech-{SPK2.lower()}": "https://kotoba-tech-kotoba-speech.hf.space/call/tts",
|
| 135 |
+
f"kotoba-speech-{SPK3.lower()}": "https://kotoba-tech-kotoba-speech.hf.space/call/tts",
|
| 136 |
+
f"kotoba-speech-{SPK4.lower()}": "https://kotoba-tech-kotoba-speech.hf.space/call/tts",
|
| 137 |
"blane-tts": "https://blane187-blane-tts.hf.space/call/get_audio_file"
|
| 138 |
}
|
| 139 |
headers = {
|
| 140 |
"Content-Type": "application/json"
|
| 141 |
}
|
| 142 |
data = {
|
| 143 |
+
f"kotoba-speech-{SPK1.lower()}": {
|
| 144 |
"data": [
|
| 145 |
text,
|
| 146 |
5,
|
| 147 |
5,
|
| 148 |
"Preset voices",
|
| 149 |
+
SPK1,
|
| 150 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"},
|
| 151 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"}
|
| 152 |
]
|
| 153 |
},
|
| 154 |
+
f"kotoba-speech-{SPK2.lower()}": {
|
| 155 |
"data": [
|
| 156 |
text,
|
| 157 |
5,
|
| 158 |
5,
|
| 159 |
"Preset voices",
|
| 160 |
+
SPK2,
|
| 161 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"},
|
| 162 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"}
|
| 163 |
]
|
| 164 |
},
|
| 165 |
+
f"kotoba-speech-{SPK3.lower()}": {
|
| 166 |
"data": [
|
| 167 |
text,
|
| 168 |
5,
|
| 169 |
5,
|
| 170 |
"Preset voices",
|
| 171 |
+
SPK3,
|
| 172 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"},
|
| 173 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"}
|
| 174 |
]
|
| 175 |
},
|
| 176 |
+
f"kotoba-speech-{SPK4.lower()}": {
|
| 177 |
"data": [
|
| 178 |
text,
|
| 179 |
5,
|
| 180 |
5,
|
| 181 |
"Preset voices",
|
| 182 |
+
SPK4,
|
| 183 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"},
|
| 184 |
{"path": "https://keikaku-hoso.com/sample_voice/voice01_A.mp3"}
|
| 185 |
]
|
|
|
|
| 398 |
# 'metavoice': 'MetaVoice-1B',
|
| 399 |
'BARK': 'BARK',
|
| 400 |
'MOE-VITS': 'MOE-VITS',
|
| 401 |
+
f'KOTOBA-SPEECH-{SPK1.upper()}': 'KOTOBA-SPEECH-SPK1',
|
| 402 |
+
f'KOTOBA-SPEECH-{SPK2.upper()}': 'KOTOBA-SPEECH-SPK2',
|
| 403 |
+
f'KOTOBA-SPEECH-{SPK3.upper()}': 'KOTOBA-SPEECH-SPK3',
|
| 404 |
+
f'KOTOBA-SPEECH-{SPK4.upper()}': 'KOTOBA-SPEECH-SPK4',
|
| 405 |
'BLANE-TTS': 'BLANE-TTS',
|
| 406 |
'AMITARO-VITS': 'AMITARO-VITS',
|
| 407 |
'GOOGLE-TTS': 'GOOGLE-TTS',
|
|
|
|
| 456 |
# 'metavoice': 'https://github.com/metavoiceio/metavoice-src',
|
| 457 |
'bark': 'https://suno-bark.hf.space/',
|
| 458 |
'moe-vits': 'skytnt/moe-tts',
|
| 459 |
+
f'kotoba-speech-{SPK1.lower()}': 'https://kotoba-tech-kotoba-speech.hf.space/',
|
| 460 |
+
f'kotoba-speech-{SPK2.lower()}': 'https://kotoba-tech-kotoba-speech.hf.space/',
|
| 461 |
+
f'kotoba-speech-{SPK3.lower()}': 'https://kotoba-tech-kotoba-speech.hf.space/',
|
| 462 |
+
f'kotoba-speech-{SPK4.lower()}': 'https://kotoba-tech-kotoba-speech.hf.space/',
|
| 463 |
'blane-tts': 'https://blane187-blane-tts.hf.space/',
|
| 464 |
'amitaro-vits': 'https://lycoris53-vits-tts-japanese-only-amitaro.hf.space/'
|
| 465 |
}
|