mirror of https://github.com/avilliai/Manyana
vits整体模块化以减少所需空间
This commit is contained in:
parent
04ab7ae26b
commit
9b70515f2d
|
@ -3,8 +3,9 @@
|
|||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.9 (Manyana) (4)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PackageRequirementsSettings">
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import asyncio
|
||||
|
||||
import httpx
|
||||
import librosa
|
||||
import requests
|
||||
import json
|
||||
# 定义请求的URL
|
||||
import soundfile
|
||||
|
||||
from plugins.newsEveryDay import get_headers
|
||||
|
||||
|
|
|
@ -6,20 +6,20 @@ import subprocess
|
|||
from asyncio import sleep
|
||||
|
||||
import httpx
|
||||
import librosa
|
||||
import requests
|
||||
import soundfile
|
||||
import websockets
|
||||
import yaml
|
||||
|
||||
from plugins.RandomStr import random_str
|
||||
from plugins.modelsLoader import modelLoader
|
||||
from plugins.translater import translate
|
||||
|
||||
from plugins.translater import translate
|
||||
try:
|
||||
from plugins.modelsLoader import modelLoader
|
||||
models, default, characters = modelLoader() # 读取模型
|
||||
from vits import vG
|
||||
except:
|
||||
print("未读取到模型,禁用vits功能")
|
||||
print("如已部署模型请运行 更新脚本 安装vits依赖")
|
||||
pass
|
||||
|
||||
with open('config/api.yaml', 'r', encoding='utf-8') as f:
|
||||
|
@ -232,7 +232,6 @@ async def superVG(data,mode,urls="",langmode="<zh>"):
|
|||
r1 = requests.get(newUrl)
|
||||
with open(p, "wb") as f:
|
||||
f.write(r1.content)
|
||||
# await change_sample_rate(p)
|
||||
return p
|
||||
elif mode=="firefly":
|
||||
datap=data
|
||||
|
@ -365,7 +364,6 @@ async def outVits(data):
|
|||
r1=requests.get(newUrl)
|
||||
with open(p, "wb") as f:
|
||||
f.write(r1.content)
|
||||
#await change_sample_rate(p)
|
||||
return p
|
||||
|
||||
async def voiceGenerate(data):
|
||||
|
@ -415,20 +413,5 @@ async def modelscopeTTS(data):
|
|||
f.write(r.content)
|
||||
return p
|
||||
|
||||
async def change_sample_rate(path,new_sample_rate=44100):
|
||||
#wavfile = path # 提取音频文件名,如“1.wav"
|
||||
# new_file_name = wavfile.split('.')[0] + '_8k.wav' #此行代码可用于对转换后的文件进行重命名(如有需要)
|
||||
|
||||
signal, sr = librosa.load(path, sr=None) # 调用librosa载入音频
|
||||
|
||||
new_signal = librosa.resample(signal, orig_sr=sr, target_sr=new_sample_rate) # 调用librosa进行音频采样率转换
|
||||
|
||||
new_path = path # 指定输出音频的路径,音频文件与原音频同名
|
||||
# new_path = os.path.join(new_dir_path, new_file_name) #若需要改名则启用此行代码
|
||||
#print("?")
|
||||
#print(new_path)
|
||||
|
||||
# librosa.output.write_wav(new_path, new_signal , new_sample_rate) #因版本问题,此方法可能用不了
|
||||
soundfile.write(new_path, new_signal, new_sample_rate)
|
||||
|
||||
#asyncio.run(outVits({"text":"你好啊,你吃饭了吗,今天吃的怎么样,开心吗?",'speaker':"黑塔"}))
|
||||
|
|
|
@ -63,7 +63,6 @@ joblib==1.3.1
|
|||
kiwisolver==1.4.4
|
||||
launart==0.6.3
|
||||
lazy_loader==0.3
|
||||
librosa==0.10.0
|
||||
llvmlite==0.40.1
|
||||
loguru==0.6.0
|
||||
lxml==4.9.3
|
||||
|
|
|
@ -15,9 +15,6 @@ import yaml
|
|||
from mirai import Image, Voice
|
||||
from mirai import Mirai, WebSocketAdapter, FriendMessage, GroupMessage, At, Plain
|
||||
|
||||
from plugins.RandomStr import random_str
|
||||
from plugins.modelsLoader import modelLoader
|
||||
from plugins.translater import translate
|
||||
from plugins.vitsGenerate import taffySayTest, superVG
|
||||
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ from mirai.models import ForwardMessageNode, Forward
|
|||
from plugins.RandomStr import random_str
|
||||
from plugins.imgSearch import test2, superSearch, test1, test
|
||||
|
||||
from plugins.modelsLoader import modelLoader
|
||||
from plugins.translater import translate
|
||||
|
||||
|
||||
def main(bot,api_key,proxy,logger):
|
||||
|
|
|
@ -6,8 +6,6 @@ from mirai import Image, Voice, Poke
|
|||
from mirai import Mirai, WebSocketAdapter, FriendMessage, GroupMessage, At, Plain
|
||||
from mirai.models import NudgeEvent
|
||||
|
||||
from plugins.modelsLoader import modelLoader
|
||||
|
||||
|
||||
def main(bot,master,logger,berturl,proxy):
|
||||
with open('config/nudgeReply.yaml', 'r', encoding='utf-8') as f:
|
||||
|
@ -23,6 +21,7 @@ def main(bot,master,logger,berturl,proxy):
|
|||
global models
|
||||
global characters
|
||||
try:
|
||||
from plugins.modelsLoader import modelLoader
|
||||
models, default, characters = modelLoader() # 读取模型
|
||||
except:
|
||||
logger.error("缺少本地vits模型,无法使用vits模式(非必要)")
|
||||
|
|
|
@ -16,7 +16,7 @@ from mirai import Image, Voice
|
|||
from mirai import Mirai, WebSocketAdapter, FriendMessage, GroupMessage, At, Plain
|
||||
|
||||
from plugins.RandomStr import random_str
|
||||
from plugins.modelsLoader import modelLoader
|
||||
|
||||
from plugins.translater import translate
|
||||
from plugins.vitsGenerate import voiceGenerate, outVits, superVG
|
||||
|
||||
|
@ -24,8 +24,6 @@ from plugins.vitsGenerate import voiceGenerate, outVits, superVG
|
|||
def main(bot,master,logger):
|
||||
logger.info("语音合成用户端启动....")
|
||||
|
||||
|
||||
|
||||
with open('config/nudgeReply.yaml', 'r', encoding='utf-8') as f:
|
||||
result = yaml.load(f.read(), Loader=yaml.FullLoader)
|
||||
with open('config/settings.yaml', 'r', encoding='utf-8') as f:
|
||||
|
@ -44,6 +42,7 @@ def main(bot,master,logger):
|
|||
global models
|
||||
global characters
|
||||
try:
|
||||
from plugins.modelsLoader import modelLoader
|
||||
models, default, characters = modelLoader() # 读取模型
|
||||
except Exception as e:
|
||||
characters={"None":"无可用模型"}
|
||||
|
|
|
@ -19,7 +19,7 @@ from mirai import Mirai, WebSocketAdapter, FriendMessage, GroupMessage, At, Plai
|
|||
|
||||
from plugins.RandomStr import random_str
|
||||
from plugins.imgDownload import dict_download_img
|
||||
from plugins.modelsLoader import modelLoader
|
||||
|
||||
from plugins.translater import translate
|
||||
from plugins.vitsGenerate import voiceGenerate, outVits, modelscopeTTS
|
||||
from plugins.wReply.mohuReply import mohuaddReplys, mohudels, mohuadd
|
||||
|
@ -144,6 +144,7 @@ def main(bot,config,sizhiKey,logger):
|
|||
global models
|
||||
global characters
|
||||
try:
|
||||
from plugins.modelsLoader import modelLoader
|
||||
models, default, characters = modelLoader() # 读取模型
|
||||
except:
|
||||
pass
|
||||
|
|
|
@ -15,7 +15,6 @@ from mirai import Image, Voice
|
|||
from mirai import Mirai, WebSocketAdapter, FriendMessage, GroupMessage, At, Plain
|
||||
|
||||
from plugins.RandomStr import random_str
|
||||
from plugins.modelsLoader import modelLoader
|
||||
from plugins.newsEveryDay import nong
|
||||
from plugins.translater import translate
|
||||
from plugins.vitsGenerate import voiceGenerate
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
librosa==0.10.0
|
||||
numba==0.57.1
|
||||
numpy==1.23.0
|
||||
torch==2.0.1
|
||||
|
|
Loading…
Reference in New Issue