最近在做AI语音对话的功能,用到了azure的语音语音服务,开发的时候还算顺利,部署到线上后,发现在正式服上无法完成语音转文本的操作,提示:
bash
org.springframework.web.util.NestedServletException: Handler dispatch
failed; nested exception is java.lang.UnsatisfiedLinkError:
com.microsoft.cognitiveservices.speech.SpeechConfig.setTempDirectory(Ljava/lang/String;)V
官方的垃圾 教程地址:
https://learn.microsoft.com/zh-cn/azure/ai-services/speech-service/how-to-configure-rhel-centos-7
注意:最好参照我的文档进行操作,因为官方文档说的不清不楚,踩了好多坑!具体原因 可看我上一篇文章的踩坑记。
一、安装依赖项
首先安装所有常规依赖项:
bash
sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
# Install development tools and libraries
sudo yum update -y
sudo yum groupinstall -y "Development tools"
sudo yum install -y alsa-lib dotnet-sdk-2.1 java-1.8.0-openjdk-devel openssl
sudo yum install -y gstreamer1 gstreamer1-plugins-base gstreamer1-plugins-good gstreamer1-plugins-bad-free gstreamer1-plugins-ugly-free
二、C/C++ 编译器和运行时库
使用此命令安装必备组件包:
bash
sudo yum install -y gmp-devel mpfr-devel libmpc-devel
接下来,更新编译器和运行时库:
bash
# Build GCC 7.5.0 and runtimes and install them under /usr/local
curl https://ftp.gnu.org/gnu/gcc/gcc-7.5.0/gcc-7.5.0.tar.gz -O
tar -xf gcc-7.5.0.tar.gz
mkdir gcc-7.5.0-build && cd gcc-7.5.0-build
../gcc-7.5.0/configure --enable-languages=c,c++ --disable-bootstrap --disable-multilib --prefix=/usr/local
make -j$(nproc)
sudo make install-strip
三、下载SpeechSDK-Linux
https://aka.ms/csspeech/linuxbinary
将下载下来的SpeechSDK-Linux-1.37.0.tar.gz文件上传到你的centos服务器中,目录随意,然后用以下命令解压缩:
bash
tar -xvzf SpeechSDK-Linux-1.37.0.tar.gz
四、环境设置
运行以下命令来完成配置:
bash
echo 'export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
bash
source ~/.bashrc
bash
echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc
bash
source ~/.bashrc
bash
export LD_LIBRARY_PATH=/data/chatgpt/speech/SpeechSDK-Linux-1.37.0/lib/centos7-x64:$LD_LIBRARY_PATH
结束语
最后欢迎大家来我站点体验下丝滑的语音服务(微信中打开这个地址体验比较好):https://pcai.wailikeji.com
需要项目源码的也可以加我v:bjxueai