Spaces:
Running
Running
mrfakename
commited on
Commit
•
4478ce8
1
Parent(s):
d3178d1
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ with open('harvard_sentences.txt') as f:
|
|
15 |
# Constants
|
16 |
####################################
|
17 |
AVAILABLE_MODELS = {
|
18 |
-
'XTTS': '
|
19 |
'WhisperSpeech': 'whisperspeech',
|
20 |
'ElevenLabs': 'eleven',
|
21 |
'OpenVoice': 'openvoice',
|
@@ -472,11 +472,11 @@ with gr.Blocks() as leaderboard:
|
|
472 |
|
473 |
# vote.load(reload, outputs=[aud1, aud2, model1, model2])
|
474 |
def doloudnorm(path):
|
475 |
-
data, rate = sf.read(path
|
476 |
meter = pyln.Meter(rate)
|
477 |
loudness = meter.integrated_loudness(data)
|
478 |
loudness_normalized_audio = pyln.normalize.loudness(data, loudness, -12.0)
|
479 |
-
sf.write(path, loudness_normalized_audio, rate
|
480 |
############
|
481 |
# 2x speedup (hopefully)
|
482 |
############
|
@@ -496,9 +496,11 @@ def synthandreturn(text):
|
|
496 |
log_text(text)
|
497 |
print("[debug] Using", mdl1, mdl2)
|
498 |
def predict_and_update_result(text, model, result_storage):
|
499 |
-
print(model, AVAILABLE_MODELS[model])
|
500 |
result = router.predict(text, AVAILABLE_MODELS[model], api_name="/synthesize")
|
501 |
-
|
|
|
|
|
|
|
502 |
result_storage[model] = result
|
503 |
results = {}
|
504 |
thread1 = threading.Thread(target=predict_and_update_result, args=(text, mdl1, results))
|
|
|
15 |
# Constants
|
16 |
####################################
|
17 |
AVAILABLE_MODELS = {
|
18 |
+
'XTTS': 'xtts',
|
19 |
'WhisperSpeech': 'whisperspeech',
|
20 |
'ElevenLabs': 'eleven',
|
21 |
'OpenVoice': 'openvoice',
|
|
|
472 |
|
473 |
# vote.load(reload, outputs=[aud1, aud2, model1, model2])
|
474 |
def doloudnorm(path):
|
475 |
+
data, rate = sf.read(path)
|
476 |
meter = pyln.Meter(rate)
|
477 |
loudness = meter.integrated_loudness(data)
|
478 |
loudness_normalized_audio = pyln.normalize.loudness(data, loudness, -12.0)
|
479 |
+
sf.write(path, loudness_normalized_audio, rate)
|
480 |
############
|
481 |
# 2x speedup (hopefully)
|
482 |
############
|
|
|
496 |
log_text(text)
|
497 |
print("[debug] Using", mdl1, mdl2)
|
498 |
def predict_and_update_result(text, model, result_storage):
|
|
|
499 |
result = router.predict(text, AVAILABLE_MODELS[model], api_name="/synthesize")
|
500 |
+
try:
|
501 |
+
doloudnorm(result)
|
502 |
+
except:
|
503 |
+
pass
|
504 |
result_storage[model] = result
|
505 |
results = {}
|
506 |
thread1 = threading.Thread(target=predict_and_update_result, args=(text, mdl1, results))
|