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

from yuisub import translate, bilingual, load
from yuisub.a2t import WhisperModel

# sub from audio
model = WhisperModel(name="medium", device="cuda")
sub = model.transcribe(audio="path/to/audio.mp3")

# sub from file
# sub = load("path/to/input.srt")

# generate bilingual subtitle
sub_zh = translate(
    sub=sub,
    model="gpt_model_name",
    api_key="your_openai_api_key",
    base_url="api_url",
    bangumi_url="https://bangumi.tv/subject/424883/"
)
sub_bilingual = bilingual(
    sub_origin=sub,
    sub_zh=sub_zh
)

# save the ASS files
sub_zh.save("path/to/output.zh.ass")
sub_bilingual.save("path/to/output.bilingual.ass")

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

yuisub-1.1.2-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yuisub-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ca95663fa80b29bb9c6c79ff3b0dabe42e57b04d26ca217b43d00998d5cb3aa1
MD5 ebc3aa3886402d8a12d867ef23dcb7b4
BLAKE2b-256 48a8473c80e3ab7a3534a8276cace63d999c4c078d7620a344dc4611b2bde11b

See more details on using hashes here.

Supported by

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