https://github.com/tensoraws/yuisub
Auto translation of new anime episodes based on Yui-MHCP001
https://github.com/tensoraws/yuisub
anime chatgpt llm openai pysubs2 subtitle translation whisper
Last synced: 5 months ago
JSON representation
Auto translation of new anime episodes based on Yui-MHCP001
- Host: GitHub
- URL: https://github.com/tensoraws/yuisub
- Owner: TensoRaws
- License: gpl-3.0
- Created: 2024-08-16T16:12:10.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-02-06T21:07:29.000Z (5 months ago)
- Last Synced: 2025-02-06T21:29:46.000Z (5 months ago)
- Topics: anime, chatgpt, llm, openai, pysubs2, subtitle, translation, whisper
- Language: Python
- Homepage:
- Size: 491 KB
- Stars: 22
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yuisub
[](https://codecov.io/gh/TensoRaws/yuisub)
[](https://github.com/TensoRaws/yuisub/actions/workflows/CI-test.yml)
[](https://github.com/TensoRaws/yuisub/actions/workflows/Release.yml)
[](https://badge.fury.io/py/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 asynciofrom 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.