parrots


Nameparrots JSON
Version 1.0.3 PyPI version JSON
download
home_pagehttps://github.com/shibing624/parrots
SummaryParrots, Automatic Speech Recognition(**ASR**), Text-To-Speech(**TTS**) toolkit
upload_time2024-02-13 06:16:30
maintainer
docs_urlNone
authorXuMing
requires_python>=3.6.0
licenseApache 2.0
keywords tts asr text to speech speech
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [**🇨🇳中文**](https://github.com/shibing624/parrots/blob/master/README.md) | [**🌐English**](https://github.com/shibing624/parrots/blob/master/README_EN.md) | [**📖文档/Docs**](https://github.com/shibing624/parrots/wiki) | [**🤖模型/Models**](https://huggingface.co/shibing624) 

<div align="center">
    <a href="https://github.com/shibing624/parrots">
    <img src="https://github.com/shibing624/parrots/blob/master/docs/parrots_icon.png" alt="Logo" height="156">
    </a>
    <br/>
    <a href="https://huggingface.co/spaces/shibing624/parrots" target="_blank"> Online Demo </a>
    <br/>
    <img width="70%" src="https://github.com/shibing624/parrots/blob/master/docs/hf.png">
</div>


-----------------

# Parrots: ASR and TTS toolkit
[![PyPI version](https://badge.fury.io/py/parrots.svg)](https://badge.fury.io/py/parrots)
[![Downloads](https://static.pepy.tech/badge/parrots)](https://pepy.tech/project/parrots)
[![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](CONTRIBUTING.md)
[![GitHub contributors](https://img.shields.io/github/contributors/shibing624/parrots.svg)](https://github.com/shibing624/parrots/graphs/contributors)
[![License Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
[![python_vesion](https://img.shields.io/badge/Python-3.7%2B-green.svg)](requirements.txt)
[![GitHub issues](https://img.shields.io/github/issues/shibing624/parrots.svg)](https://github.com/shibing624/parrots/issues)
[![Wechat Group](https://img.shields.io/badge/wechat-group-green.svg?logo=wechat)](#Contact)

## Introduction
Parrots, Automatic Speech Recognition(**ASR**), Text-To-Speech(**TTS**) toolkit, support Chinese, English, Japanese, etc.

**parrots**实现了语音识别和语音合成模型一键调用,开箱即用,支持中英文。

## Features
1. ASR:基于`distilwhisper`实现的中文语音识别(ASR)模型,支持中、英等多种语言
2. TTS:基于`GPT-SoVITS`训练的语音合成(TTS)模型,支持中、英、日等多种语言



## Install
```shell
pip install torch # or conda install pytorch
pip install -r requirements.txt
pip install parrots
```
or
```shell
pip install torch # or conda install pytorch
git clone https://github.com/shibing624/parrots.git
cd parrots
python setup.py install
```

## Demo

- Official Demo: https://www.mulanai.com/product/asr/
- HuggingFace Demo: https://huggingface.co/spaces/shibing624/parrots

run example: [examples/tts_gradio_demo.py](https://github.com/shibing624/parrots/blob/master/examples/tts_gradio_demo.py) to see the demo:
```shell
python examples/tts_gradio_demo.py
```

## Usage
### ASR(Speech Recognition)
example: [examples/demo_asr.py](https://github.com/shibing624/parrots/blob/master/examples/demo_asr.py)
```python
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': '北京图书馆'}
```

### TTS(Speech Synthesis)
example: [examples/demo_tts.py](https://github.com/shibing624/parrots/blob/master/examples/demo_tts.py)
```python
import sys

sys.path.append('..')
from parrots import TextToSpeech
m = TextToSpeech(
    speaker_model_path="shibing624/parrots-gpt-sovits-speaker-maimai",
    speaker_name="MaiMai",
    device="cpu",
    half=False
)
m.predict(
    text="你好,欢迎来北京。welcome to the city.",
    text_language="auto",
    output_path="output_audio.wav"
)
```

output:
```
Save audio to output_audio.wav
```


### 命令行模式(CLI)

支持通过命令行方式执行ARS和TTS任务,代码:[cli.py](https://github.com/shibing624/parrots/blob/master/parrots/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:

```shell
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.wav
```

- `asr`、`tts`是二级命令,asr是语音识别,tts是语音合成,默认使用的模型是中文模型
- 各二级命令使用方法见`parrots asr -h`
- 上面示例中`examples/tushuguan.wav`是`asr`方法的`audio_file_path`参数,输入的音频文件(required)


## Contact

- Issue(建议):[![GitHub issues](https://img.shields.io/github/issues/shibing624/parrots.svg)](https://github.com/shibing624/parrots/issues)
- 邮件我:xuming: xuming624@qq.com
- 微信我:加我*微信号:xuming624*, 进Python-NLP交流群,备注:*姓名-公司名-NLP*

<img src="docs/wechat.jpeg" width="200" />


## Citation

如果你在研究中使用了parrots,请按如下格式引用:

```latex
@misc{parrots,
  title={parrots: ASR and TTS Tool},
  author={Ming Xu},
  year={2024},
  howpublished={\url{https://github.com/shibing624/parrots}},
}
```

## License


授权协议为 [The Apache License 2.0](/LICENSE),可免费用做商业用途。请在产品说明中附加parrots的链接和授权协议。


## Contribute
项目代码还很粗糙,如果大家对代码有所改进,欢迎提交回本项目,在提交之前,注意以下两点:

 - 在`tests`添加相应的单元测试
 - 使用`python -m pytest`来运行所有单元测试,确保所有单测都是通过的

之后即可提交PR。


## Reference
#### ASR(Speech Recognition)
- [EAT: Enhanced ASR-TTS for Self-supervised Speech Recognition](https://arxiv.org/abs/2104.07474)
- [PaddlePaddle/PaddleSpeech](https://github.com/PaddlePaddle/PaddleSpeech)
- [NVIDIA/NeMo](https://github.com/NVIDIA/NeMo)
#### TTS(Speech Synthesis)
- [coqui-ai/TTS](https://github.com/coqui-ai/TTS)
- [keonlee9420/Expressive-FastSpeech2](https://github.com/keonlee9420/Expressive-FastSpeech2)
- [TensorSpeech/TensorflowTTS](https://github.com/TensorSpeech/TensorflowTTS)
- [RVC-Boss/GPT-SoVITS](https://github.com/RVC-Boss/GPT-SoVITS)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/shibing624/parrots",
    "name": "parrots",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6.0",
    "maintainer_email": "",
    "keywords": "TTS,ASR,text to speech,speech",
    "author": "XuMing",
    "author_email": "xuming624@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/9b/ba/aa4da0c4682ff1ced733d5ce90ea77f1583b9f271f6859026d8ccc3d382b/parrots-1.0.3.tar.gz",
    "platform": "Windows",
    "description": "[**\ud83c\udde8\ud83c\uddf3\u4e2d\u6587**](https://github.com/shibing624/parrots/blob/master/README.md) | [**\ud83c\udf10English**](https://github.com/shibing624/parrots/blob/master/README_EN.md) | [**\ud83d\udcd6\u6587\u6863/Docs**](https://github.com/shibing624/parrots/wiki) | [**\ud83e\udd16\u6a21\u578b/Models**](https://huggingface.co/shibing624) \n\n<div align=\"center\">\n    <a href=\"https://github.com/shibing624/parrots\">\n    <img src=\"https://github.com/shibing624/parrots/blob/master/docs/parrots_icon.png\" alt=\"Logo\" height=\"156\">\n    </a>\n    <br/>\n    <a href=\"https://huggingface.co/spaces/shibing624/parrots\" target=\"_blank\"> Online Demo </a>\n    <br/>\n    <img width=\"70%\" src=\"https://github.com/shibing624/parrots/blob/master/docs/hf.png\">\n</div>\n\n\n-----------------\n\n# Parrots: ASR and TTS toolkit\n[![PyPI version](https://badge.fury.io/py/parrots.svg)](https://badge.fury.io/py/parrots)\n[![Downloads](https://static.pepy.tech/badge/parrots)](https://pepy.tech/project/parrots)\n[![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](CONTRIBUTING.md)\n[![GitHub contributors](https://img.shields.io/github/contributors/shibing624/parrots.svg)](https://github.com/shibing624/parrots/graphs/contributors)\n[![License Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)\n[![python_vesion](https://img.shields.io/badge/Python-3.7%2B-green.svg)](requirements.txt)\n[![GitHub issues](https://img.shields.io/github/issues/shibing624/parrots.svg)](https://github.com/shibing624/parrots/issues)\n[![Wechat Group](https://img.shields.io/badge/wechat-group-green.svg?logo=wechat)](#Contact)\n\n## Introduction\nParrots, Automatic Speech Recognition(**ASR**), Text-To-Speech(**TTS**) toolkit, support Chinese, English, Japanese, etc.\n\n**parrots**\u5b9e\u73b0\u4e86\u8bed\u97f3\u8bc6\u522b\u548c\u8bed\u97f3\u5408\u6210\u6a21\u578b\u4e00\u952e\u8c03\u7528\uff0c\u5f00\u7bb1\u5373\u7528\uff0c\u652f\u6301\u4e2d\u82f1\u6587\u3002\n\n## Features\n1. ASR\uff1a\u57fa\u4e8e`distilwhisper`\u5b9e\u73b0\u7684\u4e2d\u6587\u8bed\u97f3\u8bc6\u522b\uff08ASR\uff09\u6a21\u578b\uff0c\u652f\u6301\u4e2d\u3001\u82f1\u7b49\u591a\u79cd\u8bed\u8a00\n2. TTS\uff1a\u57fa\u4e8e`GPT-SoVITS`\u8bad\u7ec3\u7684\u8bed\u97f3\u5408\u6210\uff08TTS\uff09\u6a21\u578b\uff0c\u652f\u6301\u4e2d\u3001\u82f1\u3001\u65e5\u7b49\u591a\u79cd\u8bed\u8a00\n\n\n\n## Install\n```shell\npip install torch # or conda install pytorch\npip install -r requirements.txt\npip install parrots\n```\nor\n```shell\npip install torch # or conda install pytorch\ngit clone https://github.com/shibing624/parrots.git\ncd parrots\npython setup.py install\n```\n\n## Demo\n\n- Official Demo: https://www.mulanai.com/product/asr/\n- HuggingFace Demo: https://huggingface.co/spaces/shibing624/parrots\n\nrun example: [examples/tts_gradio_demo.py](https://github.com/shibing624/parrots/blob/master/examples/tts_gradio_demo.py) to see the demo:\n```shell\npython examples/tts_gradio_demo.py\n```\n\n## Usage\n### ASR(Speech Recognition)\nexample: [examples/demo_asr.py](https://github.com/shibing624/parrots/blob/master/examples/demo_asr.py)\n```python\nimport os\nimport sys\n\nsys.path.append('..')\nfrom parrots import SpeechRecognition\n\npwd_path = os.path.abspath(os.path.dirname(__file__))\n\nif __name__ == '__main__':\n    m = SpeechRecognition()\n    r = m.recognize_speech_from_file(os.path.join(pwd_path, 'tushuguan.wav'))\n    print('[\u63d0\u793a] \u8bed\u97f3\u8bc6\u522b\u7ed3\u679c\uff1a', r)\n\n```\n\noutput:\n```\n{'text': '\u5317\u4eac\u56fe\u4e66\u9986'}\n```\n\n### TTS(Speech Synthesis)\nexample: [examples/demo_tts.py](https://github.com/shibing624/parrots/blob/master/examples/demo_tts.py)\n```python\nimport sys\n\nsys.path.append('..')\nfrom parrots import TextToSpeech\nm = TextToSpeech(\n    speaker_model_path=\"shibing624/parrots-gpt-sovits-speaker-maimai\",\n    speaker_name=\"MaiMai\",\n    device=\"cpu\",\n    half=False\n)\nm.predict(\n    text=\"\u4f60\u597d\uff0c\u6b22\u8fce\u6765\u5317\u4eac\u3002welcome to the city.\",\n    text_language=\"auto\",\n    output_path=\"output_audio.wav\"\n)\n```\n\noutput:\n```\nSave audio to output_audio.wav\n```\n\n\n### \u547d\u4ee4\u884c\u6a21\u5f0f\uff08CLI\uff09\n\n\u652f\u6301\u901a\u8fc7\u547d\u4ee4\u884c\u65b9\u5f0f\u6267\u884cARS\u548cTTS\u4efb\u52a1\uff0c\u4ee3\u7801\uff1a[cli.py](https://github.com/shibing624/parrots/blob/master/parrots/cli.py)\n\n```\n> parrots -h                                    \n\nNAME\n    parrots\n\nSYNOPSIS\n    parrots COMMAND\n\nCOMMANDS\n    COMMAND is one of the following:\n\n     asr\n       Entry point of asr, recognize speech from file\n\n     tts\n       Entry point of tts, generate speech audio from text\n\n```\n\nrun\uff1a\n\n```shell\npip install parrots -U\n# asr example\nparrots asr -h\nparrots asr examples/tushuguan.wav\n\n# tts example\nparrots tts -h\nparrots tts \"\u4f60\u597d\uff0c\u6b22\u8fce\u6765\u5317\u4eac\u3002welcome to the city.\" output_audio.wav\n```\n\n- `asr`\u3001`tts`\u662f\u4e8c\u7ea7\u547d\u4ee4\uff0casr\u662f\u8bed\u97f3\u8bc6\u522b\uff0ctts\u662f\u8bed\u97f3\u5408\u6210\uff0c\u9ed8\u8ba4\u4f7f\u7528\u7684\u6a21\u578b\u662f\u4e2d\u6587\u6a21\u578b\n- \u5404\u4e8c\u7ea7\u547d\u4ee4\u4f7f\u7528\u65b9\u6cd5\u89c1`parrots asr -h`\n- \u4e0a\u9762\u793a\u4f8b\u4e2d`examples/tushuguan.wav`\u662f`asr`\u65b9\u6cd5\u7684`audio_file_path`\u53c2\u6570\uff0c\u8f93\u5165\u7684\u97f3\u9891\u6587\u4ef6\uff08required\uff09\n\n\n## Contact\n\n- Issue(\u5efa\u8bae)\uff1a[![GitHub issues](https://img.shields.io/github/issues/shibing624/parrots.svg)](https://github.com/shibing624/parrots/issues)\n- \u90ae\u4ef6\u6211\uff1axuming: xuming624@qq.com\n- \u5fae\u4fe1\u6211\uff1a\u52a0\u6211*\u5fae\u4fe1\u53f7\uff1axuming624*, \u8fdbPython-NLP\u4ea4\u6d41\u7fa4\uff0c\u5907\u6ce8\uff1a*\u59d3\u540d-\u516c\u53f8\u540d-NLP*\n\n<img src=\"docs/wechat.jpeg\" width=\"200\" />\n\n\n## Citation\n\n\u5982\u679c\u4f60\u5728\u7814\u7a76\u4e2d\u4f7f\u7528\u4e86parrots\uff0c\u8bf7\u6309\u5982\u4e0b\u683c\u5f0f\u5f15\u7528\uff1a\n\n```latex\n@misc{parrots,\n  title={parrots: ASR and TTS Tool},\n  author={Ming Xu},\n  year={2024},\n  howpublished={\\url{https://github.com/shibing624/parrots}},\n}\n```\n\n## License\n\n\n\u6388\u6743\u534f\u8bae\u4e3a [The Apache License 2.0](/LICENSE)\uff0c\u53ef\u514d\u8d39\u7528\u505a\u5546\u4e1a\u7528\u9014\u3002\u8bf7\u5728\u4ea7\u54c1\u8bf4\u660e\u4e2d\u9644\u52a0parrots\u7684\u94fe\u63a5\u548c\u6388\u6743\u534f\u8bae\u3002\n\n\n## Contribute\n\u9879\u76ee\u4ee3\u7801\u8fd8\u5f88\u7c97\u7cd9\uff0c\u5982\u679c\u5927\u5bb6\u5bf9\u4ee3\u7801\u6709\u6240\u6539\u8fdb\uff0c\u6b22\u8fce\u63d0\u4ea4\u56de\u672c\u9879\u76ee\uff0c\u5728\u63d0\u4ea4\u4e4b\u524d\uff0c\u6ce8\u610f\u4ee5\u4e0b\u4e24\u70b9\uff1a\n\n - \u5728`tests`\u6dfb\u52a0\u76f8\u5e94\u7684\u5355\u5143\u6d4b\u8bd5\n - \u4f7f\u7528`python -m pytest`\u6765\u8fd0\u884c\u6240\u6709\u5355\u5143\u6d4b\u8bd5\uff0c\u786e\u4fdd\u6240\u6709\u5355\u6d4b\u90fd\u662f\u901a\u8fc7\u7684\n\n\u4e4b\u540e\u5373\u53ef\u63d0\u4ea4PR\u3002\n\n\n## Reference\n#### ASR(Speech Recognition)\n- [EAT: Enhanced ASR-TTS for Self-supervised Speech Recognition](https://arxiv.org/abs/2104.07474)\n- [PaddlePaddle/PaddleSpeech](https://github.com/PaddlePaddle/PaddleSpeech)\n- [NVIDIA/NeMo](https://github.com/NVIDIA/NeMo)\n#### TTS(Speech Synthesis)\n- [coqui-ai/TTS](https://github.com/coqui-ai/TTS)\n- [keonlee9420/Expressive-FastSpeech2](https://github.com/keonlee9420/Expressive-FastSpeech2)\n- [TensorSpeech/TensorflowTTS](https://github.com/TensorSpeech/TensorflowTTS)\n- [RVC-Boss/GPT-SoVITS](https://github.com/RVC-Boss/GPT-SoVITS)\n\n\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Parrots, Automatic Speech Recognition(**ASR**), Text-To-Speech(**TTS**) toolkit",
    "version": "1.0.3",
    "project_urls": {
        "Homepage": "https://github.com/shibing624/parrots"
    },
    "split_keywords": [
        "tts",
        "asr",
        "text to speech",
        "speech"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9bbaaa4da0c4682ff1ced733d5ce90ea77f1583b9f271f6859026d8ccc3d382b",
                "md5": "78a610885e9b5db06a038502297e23ec",
                "sha256": "fbdf113506027800e99b35412c2591031bfd4de445362c384c235a6603d1bcc8"
            },
            "downloads": -1,
            "filename": "parrots-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "78a610885e9b5db06a038502297e23ec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.0",
            "size": 5295447,
            "upload_time": "2024-02-13T06:16:30",
            "upload_time_iso_8601": "2024-02-13T06:16:30.299515Z",
            "url": "https://files.pythonhosted.org/packages/9b/ba/aa4da0c4682ff1ced733d5ce90ea77f1583b9f271f6859026d8ccc3d382b/parrots-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-13 06:16:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shibing624",
    "github_project": "parrots",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "parrots"
}
        
Elapsed time: 0.18516s