alan commited on
Commit
9be89be
·
1 Parent(s): fe1f10a
Files changed (1) hide show
  1. app.py +30 -24
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-AVA': 'kotoba-speech-ava',
55
- 'KOTOBA-SPEECH-BRIA': 'kotoba-speech-bria',
56
- 'KOTOBA-SPEECH-ALEX': 'kotoba-speech-alex',
57
- 'KOTOBA-SPEECH-JACOB': 'kotoba-speech-jacob',
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-ava": "https://kotoba-tech-kotoba-speech.hf.space/call/tts",
128
- "kotoba-speech-bria": "https://kotoba-tech-kotoba-speech.hf.space/call/tts",
129
- "kotoba-speech-alex": "https://kotoba-tech-kotoba-speech.hf.space/call/tts",
130
- "kotoba-speech-jacob": "https://kotoba-tech-kotoba-speech.hf.space/call/tts",
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-ava": {
138
  "data": [
139
  text,
140
  5,
141
  5,
142
  "Preset voices",
143
- "Ava",
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-bria": {
149
  "data": [
150
  text,
151
  5,
152
  5,
153
  "Preset voices",
154
- "Bria",
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-alex": {
160
  "data": [
161
  text,
162
  5,
163
  5,
164
  "Preset voices",
165
- "Alex",
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-jacob": {
171
  "data": [
172
  text,
173
  5,
174
  5,
175
  "Preset voices",
176
- "Jacob",
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-AVA': 'KOTOBA-SPEECH-SPK1',
396
- 'KOTOBA-SPEECH-BRIA': 'KOTOBA-SPEECH-SPK2',
397
- 'KOTOBA-SPEECH-ALEX': 'KOTOBA-SPEECH-SPK3',
398
- 'KOTOBA-SPEECH-JACOB': 'KOTOBA-SPEECH-SPK4',
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-ava': 'https://kotoba-tech-kotoba-speech.hf.space/',
454
- 'kotoba-speech-bria': 'https://kotoba-tech-kotoba-speech.hf.space/',
455
- 'kotoba-speech-alex': 'https://kotoba-tech-kotoba-speech.hf.space/',
456
- 'kotoba-speech-jacob': 'https://kotoba-tech-kotoba-speech.hf.space/',
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
  }