Skip to main content

Auto translation of new anime episodes based on Yui-MHCP001

Project description

yuisub

codecov CI-test Release-pypi PyPI version GitHub

Auto translation of new anime episodes based on Yui-MHCP001 LLM

Install

Make sure you have Python >= 3.9 installed on your system

pip install yuisub

If you wanna use the a2t module, you need to install Whisper first

# 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:

yuisub -h  # Displays help message

Library

yuisub can also be used as a library

Example

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 BSD 3-Clause - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yuisub-1.2.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file yuisub-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: yuisub-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for yuisub-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5086d2fff7598c3b97f42ff171e8147336d134036e67290b5b37699af0417902
MD5 25c8507dca53e21fec4f57e645917f07
BLAKE2b-256 5f790ba6ec38d84d80bade63922b01639d723d771cf4950ddd492b55ca466780

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page