# yuisub
[![codecov](https://codecov.io/gh/TensoRaws/yuisub/branch/main/graph/badge.svg?token=B2TNKYN4O4)](https://codecov.io/gh/TensoRaws/yuisub)
[![CI-test](https://github.com/TensoRaws/yuisub/actions/workflows/CI-test.yml/badge.svg)](https://github.com/TensoRaws/yuisub/actions/workflows/CI-test.yml)
[![Release](https://github.com/TensoRaws/yuisub/actions/workflows/Release.yml/badge.svg)](https://github.com/TensoRaws/yuisub/actions/workflows/Release.yml)
[![PyPI version](https://badge.fury.io/py/yuisub.svg)](https://badge.fury.io/py/yuisub)
![GitHub](https://img.shields.io/github/license/TensoRaws/yuisub)
Auto translation of new anime episodes based on ~~Yui-MHCP001~~ LLM
### Install
Make sure you have Python >= 3.9 installed on your system
```bash
pip install yuisub
```
If you wanna use the `a2t` module, you need to install `Whisper` first
```bash
# pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install openai-whisper
```
### Command Line Usage
`yuisub` can be used from the command line to generate bilingual ASS files. Here's how to use it:
```bash
yuisub -h # Displays help message
```
### Library
`yuisub` can also be used as a library
```python3
import asyncio
from yuisub import SubtitleTranslator
# Using an asynchronous environment
async def main() -> None:
translator = SubtitleTranslator(
# if you wanna use audio input
# torch_device='cuda',
# whisper_model='medium',
model='gpt_model_name',
api_key='your_openai_api_key',
base_url='api_url',
bangumi_url='https://bangumi.tv/subject/424883/',
bangumi_access_token='your_bangumi_token',
)
sub_zh, sub_bilingual = await translator.get_subtitles(sub='path/to/sub.srt') # Or audio='path/to/audio.mp3',
sub_zh.save('path/to/output_zh.ass')
sub_bilingual.save('path/to/output_bilingual.ass')
asyncio.run(main())
```
### License
This project is licensed under the GPL-3.0 license - see
the [LICENSE file](https://github.com/TohruskyDev/yuisub/blob/main/LICENSE) for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/TensoRaws/yuisub",
"name": "yuisub",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Tohrusky",
"author_email": null,
"download_url": null,
"platform": null,
"description": "# yuisub\n\n[![codecov](https://codecov.io/gh/TensoRaws/yuisub/branch/main/graph/badge.svg?token=B2TNKYN4O4)](https://codecov.io/gh/TensoRaws/yuisub)\n[![CI-test](https://github.com/TensoRaws/yuisub/actions/workflows/CI-test.yml/badge.svg)](https://github.com/TensoRaws/yuisub/actions/workflows/CI-test.yml)\n[![Release](https://github.com/TensoRaws/yuisub/actions/workflows/Release.yml/badge.svg)](https://github.com/TensoRaws/yuisub/actions/workflows/Release.yml)\n[![PyPI version](https://badge.fury.io/py/yuisub.svg)](https://badge.fury.io/py/yuisub)\n![GitHub](https://img.shields.io/github/license/TensoRaws/yuisub)\n\nAuto translation of new anime episodes based on ~~Yui-MHCP001~~ LLM\n\n### Install\n\nMake sure you have Python >= 3.9 installed on your system\n\n```bash\npip install yuisub\n```\n\nIf you wanna use the `a2t` module, you need to install `Whisper` first\n\n```bash\n# pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118\npip install openai-whisper\n```\n\n### Command Line Usage\n\n`yuisub` can be used from the command line to generate bilingual ASS files. Here's how to use it:\n\n```bash\nyuisub -h # Displays help message\n```\n\n### Library\n\n`yuisub` can also be used as a library\n\n```python3\nimport asyncio\n\nfrom yuisub import SubtitleTranslator\n\n# Using an asynchronous environment\nasync def main() -> None:\n translator = SubtitleTranslator(\n # if you wanna use audio input\n # torch_device='cuda',\n # whisper_model='medium',\n\n model='gpt_model_name',\n api_key='your_openai_api_key',\n base_url='api_url',\n bangumi_url='https://bangumi.tv/subject/424883/',\n bangumi_access_token='your_bangumi_token',\n )\n\n sub_zh, sub_bilingual = await translator.get_subtitles(sub='path/to/sub.srt') # Or audio='path/to/audio.mp3',\n sub_zh.save('path/to/output_zh.ass')\n sub_bilingual.save('path/to/output_bilingual.ass')\n\nasyncio.run(main())\n```\n\n### License\n\nThis project is licensed under the GPL-3.0 license - see\nthe [LICENSE file](https://github.com/TohruskyDev/yuisub/blob/main/LICENSE) for details.\n\n",
"bugtrack_url": null,
"license": "GPL-3.0-only",
"summary": "Auto translation of new anime episodes based on Yui-MHCP001",
"version": "1.2.1",
"project_urls": {
"Homepage": "https://github.com/TensoRaws/yuisub",
"Repository": "https://github.com/TensoRaws/yuisub"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bbb74354e92291db6b41c18ba6d693a7c11ae55e24d1cf4d7ed7120bb9b9d0f4",
"md5": "6ff55c084a8c6ad60ed0ac5d94bce35e",
"sha256": "91ced457e726e65ee6c571fe985153b5b647e1ef9b89daf1d43f5b7e122128b6"
},
"downloads": -1,
"filename": "yuisub-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6ff55c084a8c6ad60ed0ac5d94bce35e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 23900,
"upload_time": "2025-01-02T17:13:28",
"upload_time_iso_8601": "2025-01-02T17:13:28.392146Z",
"url": "https://files.pythonhosted.org/packages/bb/b7/4354e92291db6b41c18ba6d693a7c11ae55e24d1cf4d7ed7120bb9b9d0f4/yuisub-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-02 17:13:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "TensoRaws",
"github_project": "yuisub",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "yuisub"
}