Spaces:
Build error
Build error
is
Browse files- src/utils.py +3 -4
src/utils.py
CHANGED
|
@@ -19,6 +19,7 @@ import gc
|
|
| 19 |
import subprocess
|
| 20 |
import psutil
|
| 21 |
import yaml
|
|
|
|
| 22 |
|
| 23 |
import tqdm
|
| 24 |
import torch
|
|
@@ -93,11 +94,11 @@ def generate(**kwargs):
|
|
| 93 |
|
| 94 |
voice_cache = {}
|
| 95 |
def fetch_voice( voice ):
|
| 96 |
-
print(f"Loading voice: {voice} with model {tts.autoregressive_model_hash[:8]}")
|
| 97 |
cache_key = f'{voice}:{tts.autoregressive_model_hash[:8]}'
|
| 98 |
if cache_key in voice_cache:
|
| 99 |
return voice_cache[cache_key]
|
| 100 |
|
|
|
|
| 101 |
sample_voice = None
|
| 102 |
if voice == "microphone":
|
| 103 |
if parameters['mic_audio'] is None:
|
|
@@ -458,8 +459,6 @@ def cancel_generate():
|
|
| 458 |
tortoise.api.STOP_SIGNAL = True
|
| 459 |
|
| 460 |
def hash_file(path, algo="md5", buffer_size=0):
|
| 461 |
-
import hashlib
|
| 462 |
-
|
| 463 |
hash = None
|
| 464 |
if algo == "md5":
|
| 465 |
hash = hashlib.md5()
|
|
@@ -1523,7 +1522,7 @@ def import_voices(files, saveAs=None, progress=None):
|
|
| 1523 |
def get_voice_list(dir=get_voice_dir(), append_defaults=False):
|
| 1524 |
defaults = [ "random", "microphone" ]
|
| 1525 |
os.makedirs(dir, exist_ok=True)
|
| 1526 |
-
res = sorted([d for d in os.listdir(dir) if d
|
| 1527 |
if append_defaults:
|
| 1528 |
res = res + defaults
|
| 1529 |
return res
|
|
|
|
| 19 |
import subprocess
|
| 20 |
import psutil
|
| 21 |
import yaml
|
| 22 |
+
import hashlib
|
| 23 |
|
| 24 |
import tqdm
|
| 25 |
import torch
|
|
|
|
| 94 |
|
| 95 |
voice_cache = {}
|
| 96 |
def fetch_voice( voice ):
|
|
|
|
| 97 |
cache_key = f'{voice}:{tts.autoregressive_model_hash[:8]}'
|
| 98 |
if cache_key in voice_cache:
|
| 99 |
return voice_cache[cache_key]
|
| 100 |
|
| 101 |
+
print(f"Loading voice: {voice} with model {tts.autoregressive_model_hash[:8]}")
|
| 102 |
sample_voice = None
|
| 103 |
if voice == "microphone":
|
| 104 |
if parameters['mic_audio'] is None:
|
|
|
|
| 459 |
tortoise.api.STOP_SIGNAL = True
|
| 460 |
|
| 461 |
def hash_file(path, algo="md5", buffer_size=0):
|
|
|
|
|
|
|
| 462 |
hash = None
|
| 463 |
if algo == "md5":
|
| 464 |
hash = hashlib.md5()
|
|
|
|
| 1522 |
def get_voice_list(dir=get_voice_dir(), append_defaults=False):
|
| 1523 |
defaults = [ "random", "microphone" ]
|
| 1524 |
os.makedirs(dir, exist_ok=True)
|
| 1525 |
+
res = sorted([d for d in os.listdir(dir) if d not in defaults and os.path.isdir(os.path.join(dir, d)) and len(os.listdir(os.path.join(dir, d))) > 0 ])
|
| 1526 |
if append_defaults:
|
| 1527 |
res = res + defaults
|
| 1528 |
return res
|