parrots
1.0.1
??中文| English |文檔/Docs | ?模型/Models


Parrots, Automatic Speech Recognition( ASR ), Text-To-Speech( TTS ) toolkit, support Chinese, English, Japanese, etc.
parrots實現了語音識別和語音合成模型一鍵調用,開箱即用,支持中英文。
distilwhisper實現的中文語音識別(ASR)模型,支持中、英等多種語言GPT-SoVITS訓練的語音合成(TTS)模型,支持中、英、日等多種語言pip install torch # or conda install pytorch
pip install -r requirements.txt
pip install parrotsor
pip install torch # or conda install pytorch
git clone https://github.com/shibing624/parrots.git
cd parrots
python setup.py install
run example: examples/tts_gradio_demo.py to see the demo:
python examples/tts_gradio_demo.pyexample: examples/demo_asr.py
import os
import sys
sys . path . append ( '..' )
from parrots import SpeechRecognition
pwd_path = os . path . abspath ( os . path . dirname ( __file__ ))
if __name__ == '__main__' :
m = SpeechRecognition ()
r = m . recognize_speech_from_file ( os . path . join ( pwd_path , 'tushuguan.wav' ))
print ( '[提示] 语音识别结果:' , r )output:
{'text': '北京图书馆'}
example: examples/demo_tts.py
import sys
sys . path . append ( '..' )
import parrots
from parrots . tts import TextToSpeech
parrots_path = parrots . __path__ [ 0 ]
sys . path . append ( parrots_path )
m = TextToSpeech (
speaker_model_path = "shibing624/parrots-gpt-sovits-speaker-maimai" ,
speaker_name = "MaiMai" ,
)
m . predict (
text = "你好,欢迎来北京。welcome to the city." ,
text_language = "auto" ,
output_path = "output_audio.wav"
)output:
Save audio to output_audio.wav
支持通過命令行方式執行ARS和TTS任務,代碼:cli.py
> parrots -h
NAME
parrots
SYNOPSIS
parrots COMMAND
COMMANDS
COMMAND is one of the following:
asr
Entry point of asr, recognize speech from file
tts
Entry point of tts, generate speech audio from text
run:
pip install parrots -U
# asr example
parrots asr -h
parrots asr examples/tushuguan.wav
# tts example
parrots tts -h
parrots tts "你好,欢迎来北京。welcome to the city. " output_audio.wavasr 、 tts是二級命令,asr是語音識別,tts是語音合成,默認使用的模型是中文模型parrots asr -hexamples/tushuguan.wav是asr方法的audio_file_path參數,輸入的音頻文件(required) | speaker name | 說話人名 | character | 角色特點 | language | 語言 |
|---|---|---|---|---|---|
| KuileBlanc | 葵·勒布朗 | lady | 標準美式女聲 | en | 英 |
| LongShouRen | 龍守仁 | gentleman | 標準美式男聲 | en | 英 |
| MaiMai | 賣賣 | singing female anchor | 唱歌女主播聲 | zh | 中 |
| XingTong | 星瞳 | singing ai girl | 活潑女聲 | zh | 中 |
| XuanShen | 炫神 | game male anchor | 遊戲男主播聲 | zh | 中 |
| KusanagiNene | 草薙寧々 | loli | 蘿莉女學生聲 | ja | 日 |
| speaker name | 說話人名 | character | 角色特點 | language | 語言 |
|---|---|---|---|---|---|
| MaiMai | 賣賣 | singing female anchor | 唱歌女主播聲 | zh | 中 |

如果你在研究中使用了parrots,請按如下格式引用:
@misc{parrots,
title={parrots: ASR and TTS Tool},
author={Ming Xu},
year={2024},
howpublished={ url {https://github.com/shibing624/parrots}},
}授權協議為The Apache License 2.0,可免費用做商業用途。請在產品說明中附加parrots的鏈接和授權協議。
項目代碼還很粗糙,如果大家對代碼有所改進,歡迎提交回本項目,在提交之前,注意以下兩點:
tests添加相應的單元測試python -m pytest來運行所有單元測試,確保所有單測都是通過的之後即可提交PR。