MCPcopy
hub / github.com/2noise/ChatTTS / load_chat

Function load_chat

examples/web/funcs.py:75–110  ·  view source on GitHub ↗
(cust_path: Optional[str], coef: Optional[str])

Source from the content-addressed store, hash-verified

73
74
75def load_chat(cust_path: Optional[str], coef: Optional[str]) -> bool:
76 global enable_cache, experimental
77
78 if cust_path == None:
79 ret = chat.load(coef=coef, enable_cache=enable_cache, experimental=experimental)
80 else:
81 logger.info("local model path: %s", cust_path)
82 ret = chat.load(
83 "custom",
84 custom_path=cust_path,
85 coef=coef,
86 enable_cache=enable_cache,
87 experimental=experimental,
88 )
89 global custom_path
90 custom_path = cust_path
91 if ret:
92 try:
93 chat.normalizer.register("en", normalizer_en_nemo_text())
94 except ValueError as e:
95 logger.error(e)
96 except:
97 logger.warning("Package nemo_text_processing not found!")
98 logger.warning(
99 "Run: conda install -c conda-forge pynini=2.1.5 && pip install nemo_text_processing",
100 )
101 try:
102 chat.normalizer.register("zh", normalizer_zh_tn())
103 except ValueError as e:
104 logger.error(e)
105 except:
106 logger.warning("Package WeTextProcessing not found!")
107 logger.warning(
108 "Run: conda install -c conda-forge pynini=2.1.5 && pip install WeTextProcessing",
109 )
110 return ret
111
112
113def reload_chat(coef: Optional[str]) -> str:

Callers 2

reload_chatFunction · 0.85
mainFunction · 0.85

Calls 4

normalizer_en_nemo_textFunction · 0.90
normalizer_zh_tnFunction · 0.90
loadMethod · 0.80
registerMethod · 0.80

Tested by

no test coverage detected