Add files via upload
This commit is contained in:
+13
-9
@@ -16,10 +16,7 @@ class MegaTTS3:
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
if not MegaTTS3.initialization_done:
|
||||
initialize()
|
||||
MegaTTS3.initialization_done = True
|
||||
|
||||
# Removed initialization here to prevent startup loading
|
||||
voice_samples = get_voice_samples()
|
||||
default_voice = voice_samples[0] if voice_samples else ""
|
||||
return {
|
||||
@@ -42,6 +39,11 @@ class MegaTTS3:
|
||||
pronunciation_strength, voice_similarity,
|
||||
reference_voice):
|
||||
|
||||
# Initialize when the node is actually used
|
||||
if not MegaTTS3.initialization_done:
|
||||
initialize()
|
||||
MegaTTS3.initialization_done = True
|
||||
|
||||
if MegaTTS3.infer_instance_cache is not None:
|
||||
infer_instance = MegaTTS3.infer_instance_cache
|
||||
else:
|
||||
@@ -81,10 +83,7 @@ class MegaTTS3S:
|
||||
infer_instance_cache = None
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
if not getattr(MegaTTS3, 'initialization_done', False):
|
||||
initialize()
|
||||
MegaTTS3.initialization_done = True
|
||||
|
||||
# Remove initialization here
|
||||
voice_samples = get_voice_samples()
|
||||
default_voice = voice_samples[0] if voice_samples else ""
|
||||
return {
|
||||
@@ -101,6 +100,11 @@ class MegaTTS3S:
|
||||
CATEGORY = "🧪AILab/🔊Audio"
|
||||
|
||||
def generate_speech(self, input_text, language, reference_voice):
|
||||
# Initialize when the node is actually used
|
||||
if not MegaTTS3.initialization_done:
|
||||
initialize()
|
||||
MegaTTS3.initialization_done = True
|
||||
|
||||
if MegaTTS3S.infer_instance_cache is not None:
|
||||
infer_instance = MegaTTS3S.infer_instance_cache
|
||||
else:
|
||||
@@ -148,7 +152,7 @@ class MegaTTS_CleanMemory:
|
||||
RETURN_TYPES = ("*",)
|
||||
RETURN_NAMES = ("output",)
|
||||
FUNCTION = "clean_memory"
|
||||
CATEGORY = "🧪AILab/🔊Audio"
|
||||
CATEGORY = "🧪AILab/🛠️UTIL"
|
||||
|
||||
def clean_memory(self, any):
|
||||
if MegaTTS3.infer_instance_cache is not None:
|
||||
|
||||
@@ -13,10 +13,6 @@ class MegaTTS_VoiceMaker:
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
if not getattr(MegaTTS3, 'initialization_done', False):
|
||||
initialize()
|
||||
MegaTTS3.initialization_done = True
|
||||
|
||||
return {
|
||||
"required": {
|
||||
"audio_in": ("AUDIO", {"tooltip": "Input audio to be converted."}),
|
||||
@@ -34,6 +30,10 @@ class MegaTTS_VoiceMaker:
|
||||
CATEGORY = "🧪AILab/🔊Audio"
|
||||
|
||||
def convert_voice(self, audio_in, voice_name, path="", trim_silence=True, normalize_volume=True, max_duration=10.0):
|
||||
if not MegaTTS3.initialization_done:
|
||||
initialize()
|
||||
MegaTTS3.initialization_done = True
|
||||
|
||||
if MegaTTS_VoiceMaker.infer_instance_cache is not None:
|
||||
infer_instance = MegaTTS_VoiceMaker.infer_instance_cache
|
||||
else:
|
||||
|
||||
+1
-5
@@ -136,8 +136,4 @@ def initialize():
|
||||
except Exception as e:
|
||||
print(f"Error during initialization: {str(e)}")
|
||||
traceback.print_exc()
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Starting MegaTTS initialization...")
|
||||
initialize()
|
||||
return False
|
||||
+17
-17
@@ -1,18 +1,18 @@
|
||||
from .AILab_MegaTTS import NODE_CLASS_MAPPINGS as MEGATTS_NODE_CLASS_MAPPINGS
|
||||
from .AILab_MegaTTS import NODE_DISPLAY_NAME_MAPPINGS as MEGATTS_NODE_DISPLAY_NAME_MAPPINGS
|
||||
from .MegaTTS_VoiceMaker import NODE_CLASS_MAPPINGS as VOICEMAKER_NODE_CLASS_MAPPINGS
|
||||
from .MegaTTS_VoiceMaker import NODE_DISPLAY_NAME_MAPPINGS as VOICEMAKER_NODE_DISPLAY_NAME_MAPPINGS
|
||||
|
||||
from .MegaTTS_utils import get_voice_samples, get_voice_path
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
**MEGATTS_NODE_CLASS_MAPPINGS,
|
||||
**VOICEMAKER_NODE_CLASS_MAPPINGS
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
**MEGATTS_NODE_DISPLAY_NAME_MAPPINGS,
|
||||
**VOICEMAKER_NODE_DISPLAY_NAME_MAPPINGS
|
||||
}
|
||||
|
||||
from .AILab_MegaTTS import NODE_CLASS_MAPPINGS as MEGATTS_NODE_CLASS_MAPPINGS
|
||||
from .AILab_MegaTTS import NODE_DISPLAY_NAME_MAPPINGS as MEGATTS_NODE_DISPLAY_NAME_MAPPINGS
|
||||
from .MegaTTS_VoiceMaker import NODE_CLASS_MAPPINGS as VOICEMAKER_NODE_CLASS_MAPPINGS
|
||||
from .MegaTTS_VoiceMaker import NODE_DISPLAY_NAME_MAPPINGS as VOICEMAKER_NODE_DISPLAY_NAME_MAPPINGS
|
||||
|
||||
from .MegaTTS_utils import get_voice_samples, get_voice_path
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
**MEGATTS_NODE_CLASS_MAPPINGS,
|
||||
**VOICEMAKER_NODE_CLASS_MAPPINGS
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
**MEGATTS_NODE_DISPLAY_NAME_MAPPINGS,
|
||||
**VOICEMAKER_NODE_DISPLAY_NAME_MAPPINGS
|
||||
}
|
||||
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
Reference in New Issue
Block a user