没有办法吗?;)
import ChatTTS
import torch
import torchaudio
from typing import Optional
from tools.audio import float_to_int16, load_audio
用“tools.audio” 的时候还有这个问题: No module named 'tools.audio'
Comparing code within funcs.py and its references, seems that "tools.audio" it's not a module which could be installed from pypi or somewhere else, however, it's definitely a tools package from ChatTTS root folder. So if we got "No module named 'tools.audio' message, it might be caused by Python couldn't read back from ChatTTS' root folder which containing /tools/audio/av.py, this one defines how "float_to_init16" and "load_audio" working.
So, just copy "ChatTTS" and "tools" folder into examples/web , problem solved.
Another way to fix:
add lines:
import sys
sys.path.append("..")
sys.path.append("../..")
into funcs.py after " import gradio as gr ".
have fun :)