Skip to main content

yuisub

codecov CI-test Release 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

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 for details.

Metadata

Release files for yuisub 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for yuisub 1.3.1
File Interpreter ABI Platform
yuisub-1.3.1-py3-none-any.whl Python 3 none any Details

Release files / yuisub-1.3.1-py3-none-any.whl

Download URL yuisub-1.3.1-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e02a34b8889c82a71e787d72a387597595588f0bfe952bb15eed09f69d9d5729
BLAKE2b-256 checksum
How to use checksums
2010431ae2e6f2f65c6c00d5aa794a8c62df7ab2870f8fa9358de524eb746219
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for yuisub 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page