Spaces:
Running
Running
x-ip-token to headers only for Zero-GPU spaces
Browse files
app.py
CHANGED
@@ -89,8 +89,12 @@ AVAILABLE_MODELS = {
|
|
89 |
'mrfakename/E2-F5-TTS': 'mrfakename/E2-F5-TTS', # 5.0
|
90 |
|
91 |
# # Parler
|
|
|
92 |
'parler-tts/parler_tts': 'parler-tts/parler_tts', # 4.29 4.32 4.36.1 4.42.0
|
93 |
-
|
|
|
|
|
|
|
94 |
|
95 |
# # Microsoft Edge TTS
|
96 |
'innoai/Edge-TTS-Text-to-Speech': 'innoai/Edge-TTS-Text-to-Speech', # 4.29
|
@@ -104,7 +108,6 @@ AVAILABLE_MODELS = {
|
|
104 |
# 'styletts2/styletts2': '0#0', # API disabled, awaiting approval of PR #15
|
105 |
# 'Manmay/tortoise-tts': '/predict#0', # Cannot retrieve streamed file; 403
|
106 |
# 'pytorch/Tacotron2': '0#0', # old gradio
|
107 |
-
# 'parler-tts/parler_tts_mini': 'parler-tts/parler_tts_mini', # Mini is the default model of parler_tts
|
108 |
}
|
109 |
|
110 |
HF_SPACES = {
|
@@ -178,20 +181,23 @@ HF_SPACES = {
|
|
178 |
'function': '/gen_tts',
|
179 |
'text_param_index': 0,
|
180 |
'return_audio_index': 0,
|
|
|
181 |
},
|
182 |
# Parler Mini
|
183 |
-
'parler-tts/
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
189 |
# Parler Mini which using Expresso dataset
|
190 |
'parler-tts/parler-tts-expresso': {
|
191 |
'name': 'Parler Mini Expresso',
|
192 |
'function': '/gen_tts',
|
193 |
'text_param_index': 0,
|
194 |
'return_audio_index': 0,
|
|
|
195 |
},
|
196 |
|
197 |
# Microsoft Edge TTS
|
@@ -217,6 +223,7 @@ HF_SPACES = {
|
|
217 |
'function': '/infer',
|
218 |
'text_param_index': 2,
|
219 |
'return_audio_index': 0,
|
|
|
220 |
},
|
221 |
|
222 |
# TTS w issues
|
@@ -1000,7 +1007,8 @@ def synthandreturn(text, request: gr.Request):
|
|
1000 |
|
1001 |
hf_headers = {}
|
1002 |
try:
|
1003 |
-
|
|
|
1004 |
except:
|
1005 |
pass
|
1006 |
# 3 attempts
|
|
|
89 |
'mrfakename/E2-F5-TTS': 'mrfakename/E2-F5-TTS', # 5.0
|
90 |
|
91 |
# # Parler
|
92 |
+
# Parler Large model
|
93 |
'parler-tts/parler_tts': 'parler-tts/parler_tts', # 4.29 4.32 4.36.1 4.42.0
|
94 |
+
# Parler Mini model
|
95 |
+
# 'parler-tts/parler_tts': 'parler-tts/parler_tts', # 4.29 4.32 4.36.1 4.42.0
|
96 |
+
# 'parler-tts/parler_tts_mini': 'parler-tts/parler_tts_mini', # Mini is the default model of parler_tts
|
97 |
+
# 'parler-tts/parler-tts-expresso': 'parler-tts/parler-tts-expresso', # 4.29 4.32 4.36.1 4.42.0
|
98 |
|
99 |
# # Microsoft Edge TTS
|
100 |
'innoai/Edge-TTS-Text-to-Speech': 'innoai/Edge-TTS-Text-to-Speech', # 4.29
|
|
|
108 |
# 'styletts2/styletts2': '0#0', # API disabled, awaiting approval of PR #15
|
109 |
# 'Manmay/tortoise-tts': '/predict#0', # Cannot retrieve streamed file; 403
|
110 |
# 'pytorch/Tacotron2': '0#0', # old gradio
|
|
|
111 |
}
|
112 |
|
113 |
HF_SPACES = {
|
|
|
181 |
'function': '/gen_tts',
|
182 |
'text_param_index': 0,
|
183 |
'return_audio_index': 0,
|
184 |
+
'is_zero_gpu_space': True,
|
185 |
},
|
186 |
# Parler Mini
|
187 |
+
# 'parler-tts/parler_tts': {
|
188 |
+
# 'name': 'Parler Large',
|
189 |
+
# 'function': '/gen_tts',
|
190 |
+
# 'text_param_index': 0,
|
191 |
+
# 'return_audio_index': 0,
|
192 |
+
# 'is_zero_gpu_space': True,
|
193 |
+
# },
|
194 |
# Parler Mini which using Expresso dataset
|
195 |
'parler-tts/parler-tts-expresso': {
|
196 |
'name': 'Parler Mini Expresso',
|
197 |
'function': '/gen_tts',
|
198 |
'text_param_index': 0,
|
199 |
'return_audio_index': 0,
|
200 |
+
'is_zero_gpu_space': True,
|
201 |
},
|
202 |
|
203 |
# Microsoft Edge TTS
|
|
|
223 |
'function': '/infer',
|
224 |
'text_param_index': 2,
|
225 |
'return_audio_index': 0,
|
226 |
+
'is_zero_gpu_space': True,
|
227 |
},
|
228 |
|
229 |
# TTS w issues
|
|
|
1007 |
|
1008 |
hf_headers = {}
|
1009 |
try:
|
1010 |
+
if HF_SPACES[model]['is_zero_gpu_space']:
|
1011 |
+
hf_headers = {"X-IP-Token": request.headers['x-ip-token']}
|
1012 |
except:
|
1013 |
pass
|
1014 |
# 3 attempts
|