Spaces:
Running
on
Zero
Running
on
Zero
zhzluke96
commited on
Commit
•
49bce5c
1
Parent(s):
01e655b
update
Browse files- modules/generate_audio.py +5 -3
- modules/speaker.py +4 -2
modules/generate_audio.py
CHANGED
@@ -69,12 +69,14 @@ def generate_audio_batch(
|
|
69 |
if isinstance(spk, int):
|
70 |
with SeedContext(spk):
|
71 |
params_infer_code["spk_emb"] = chat_tts.sample_random_speaker()
|
72 |
-
logger.
|
73 |
elif isinstance(spk, Speaker):
|
74 |
params_infer_code["spk_emb"] = spk.emb
|
75 |
-
logger.
|
|
|
|
|
76 |
|
77 |
-
logger.
|
78 |
{
|
79 |
"text": texts,
|
80 |
"infer_seed": infer_seed,
|
|
|
69 |
if isinstance(spk, int):
|
70 |
with SeedContext(spk):
|
71 |
params_infer_code["spk_emb"] = chat_tts.sample_random_speaker()
|
72 |
+
logger.debug(("spk", spk))
|
73 |
elif isinstance(spk, Speaker):
|
74 |
params_infer_code["spk_emb"] = spk.emb
|
75 |
+
logger.debug(("spk", spk.name))
|
76 |
+
else:
|
77 |
+
raise ValueError("spk must be int or Speaker")
|
78 |
|
79 |
+
logger.debug(
|
80 |
{
|
81 |
"text": texts,
|
82 |
"infer_seed": infer_seed,
|
modules/speaker.py
CHANGED
@@ -106,8 +106,10 @@ class SpeakerManager:
|
|
106 |
return speaker
|
107 |
|
108 |
def get_speaker(self, name) -> Speaker | None:
|
109 |
-
|
110 |
-
|
|
|
|
|
111 |
|
112 |
def get_speaker_by_id(self, id) -> Speaker | None:
|
113 |
for speaker in self.speakers.values():
|
|
|
106 |
return speaker
|
107 |
|
108 |
def get_speaker(self, name) -> Speaker | None:
|
109 |
+
for speaker in self.speakers.values():
|
110 |
+
if speaker.name == name:
|
111 |
+
return speaker
|
112 |
+
return None
|
113 |
|
114 |
def get_speaker_by_id(self, id) -> Speaker | None:
|
115 |
for speaker in self.speakers.values():
|