Spaces:
Running
Running
zach
commited on
Commit
·
25014be
1
Parent(s):
a98f109
Update choose_providers to make option B Hume only 30% of the time and remove check for presence of character description
Browse files- src/app.py +1 -1
- src/utils.py +12 -13
src/app.py
CHANGED
@@ -126,7 +126,7 @@ class App:
|
|
126 |
|
127 |
# Select 2 TTS providers based on whether the text has been modified.
|
128 |
text_modified = text != generated_text_state
|
129 |
-
provider_a, provider_b = choose_providers(text_modified
|
130 |
|
131 |
try:
|
132 |
start_time = time.time()
|
|
|
126 |
|
127 |
# Select 2 TTS providers based on whether the text has been modified.
|
128 |
text_modified = text != generated_text_state
|
129 |
+
provider_a, provider_b = choose_providers(text_modified)
|
130 |
|
131 |
try:
|
132 |
start_time = time.time()
|
src/utils.py
CHANGED
@@ -203,32 +203,31 @@ def save_base64_audio_to_file(base64_audio: str, filename: str, config: Config)
|
|
203 |
return str(relative_path)
|
204 |
|
205 |
|
206 |
-
def choose_providers(
|
207 |
-
text_modified: bool,
|
208 |
-
character_description: str,
|
209 |
-
) -> Tuple[TTSProviderName, TTSProviderName]:
|
210 |
"""
|
211 |
Select two TTS providers based on whether the text has been modified.
|
212 |
|
213 |
-
The first provider is always set to "Hume AI". For the second provider
|
214 |
-
|
215 |
-
|
216 |
|
217 |
Args:
|
218 |
text_modified (bool): A flag indicating whether the text has been modified.
|
219 |
-
- If True, both providers will be "Hume AI".
|
220 |
-
- If False, the second provider is randomly selected from TTS_PROVIDERS.
|
221 |
|
222 |
Returns:
|
223 |
Tuple[TTSProviderName, TTSProviderName]: A tuple containing two TTS provider names,
|
224 |
-
where the first is always "Hume AI" and the second is determined by the
|
225 |
-
|
226 |
"""
|
227 |
|
228 |
-
hume_comparison_only = text_modified
|
229 |
|
230 |
provider_a = constants.HUME_AI
|
231 |
-
|
|
|
|
|
|
|
|
|
232 |
|
233 |
return provider_a, provider_b
|
234 |
|
|
|
203 |
return str(relative_path)
|
204 |
|
205 |
|
206 |
+
def choose_providers(text_modified: bool) -> Tuple[TTSProviderName, TTSProviderName]:
|
|
|
|
|
|
|
207 |
"""
|
208 |
Select two TTS providers based on whether the text has been modified.
|
209 |
|
210 |
+
The first provider is always set to "Hume AI". For the second provider:
|
211 |
+
- If the text has been modified or no character description is provided, it will be "Hume AI"
|
212 |
+
- Otherwise, it will be "Hume AI" 30% of the time and "ElevenLabs" 70% of the time
|
213 |
|
214 |
Args:
|
215 |
text_modified (bool): A flag indicating whether the text has been modified.
|
|
|
|
|
216 |
|
217 |
Returns:
|
218 |
Tuple[TTSProviderName, TTSProviderName]: A tuple containing two TTS provider names,
|
219 |
+
where the first is always "Hume AI" and the second is determined by the conditions
|
220 |
+
and probability distribution described above.
|
221 |
"""
|
222 |
|
223 |
+
hume_comparison_only = text_modified
|
224 |
|
225 |
provider_a = constants.HUME_AI
|
226 |
+
|
227 |
+
if hume_comparison_only:
|
228 |
+
provider_b = constants.HUME_AI
|
229 |
+
else:
|
230 |
+
provider_b = constants.HUME_AI if random.random() < 0.3 else constants.ELEVENLABS
|
231 |
|
232 |
return provider_a, provider_b
|
233 |
|