Skip to main content

A simple tool to make the video, audio, subtitle and video-url (especially youtube) content into a written markdown files with the ability to rewritten the oral expression into written ones, or translating the content into a target language by using LLM.

Project description

Wenbi

A simple tool to make the video, audio, subtitle and video-url (especially youtube) content into a written markdown files with the ability to rewritten the oral expression into written ones, or translating the content into a target language by using LLM.

Initally, this porject is just serving to my website GCDFL. We do a service to turn its lectures into a written files for easier further editing.

Wenbi is a Chinese name 文笔, meaning a good writting.

:warning: LLM can make mistakes (of course, human make mistakes too) and cannot be fully trusted. LLM can only be used for preliminary processing of data, some elementary work, and in this sense, LLM does greatly improve editing efficiency.

you can try the demo.

Features

  • 100% Open source and totally free of use. I love open source, I learned a lot from it.

  • :100: Accept most popular audio, video, subtitle files and url--mainly using yt-dlp as input.

  • :100: Editing the files by using LLM to rewriting and translating the content into a readable written markdown files.

  • :100: Support input with multiple languages.

  • :100: offer an commandline and gradio GUI with multiple options for further personal settings

  • :100: The support provider is Ollama, you can use most of the models from ollama.

  • :construction: other provider supporting, such as OpenAi, Google and Others.

  • :construction: fine-tuned model for specific job, for example for my personal project from GCDFL, introducing the eastern churches to Chinese audience through academic lectures; CTCFOL, The Chinese Translation of Church Fathers from Original Languages.

:warning: the default translating and rewritten language are Chinese, however, you can choose other Ollama models, and languages through our commandline options.

Install

  • You can install through pip (or other tools as uv or rye) and from source.

prerequest

  • Install Ollama and dowload a model. The default model for this project is qwen2.5.

Install through pip

  1. build a virtue environment through uv--recommened or conda.

-for uv: uv venv --python 3.12

  1. uv pip install wenbi or uv add wenbi

:warning: due to some package issues, it is better to install llvmlite and numba first by uv add llvmlite numba , then install wenbi.

After install, you can simply using wenbi commandline. if you want a gradio GUI, you can run wenbi --gui. the commandline options as follow:

wenbi: Convert video, audio, URL, or subtitle files to CSV and Markdown outputs.

positional arguments:
  input                 Path to input file or URL

options:
  -h, --help            show this help message and exit
  --output-dir OUTPUT_DIR, -o OUTPUT_DIR
                        Output directory (optional)
  --gui, -g             Launch Gradio GUI
  --rewrite-llm REWRITE_LLM, -rlm REWRITE_LLM
                        Rewrite LLM model identifier (optional)
  --translate-llm TRANSLATE_LLM, -tlm TRANSLATE_LLM
                        Translation LLM model identifier (optional)
  --transcribe-lang TRANSCRIBE_LANG, -s TRANSCRIBE_LANG
                        Transcribe language (optional)
  --translate-lang TRANSLATE_LANG, -t TRANSLATE_LANG
                        Target translation language (default: Chinese)
  --rewrite-lang REWRITE_LANG, -r REWRITE_LANG
                        Target language for rewriting (default: Chinese)
  --multi-language, -m  Enable multi-language processing
  --chunk-length CHUNK_LENGTH, -c CHUNK_LENGTH
                        the chunk of Number of sentences per paragraph for llm to tranlsate or rewrite.
                        (default: 8)
  --max-tokens MAX_TOKENS, -mt MAX_TOKENS
                        Maximum tokens for LLM output (default: 50000)
  --timeout TIMEOUT, -to TIMEOUT
                        LLM request timeout in seconds (default: 3600)
  --temperature TEMPERATURE, -tm TEMPERATURE
                        LLM temperature parameter (default: 0.1)
  --base-url BASE_URL, -u BASE_URL
                        Base URL for LLM API (default: http://localhost:11434)
  --transcribe-model {tiny,base,small,medium,large-v1,large-v2,large-v3}, -tsm {tiny,base,small,medium,large-v1,large-v2,large-v3,turbo}
                        Whisper model size for transcription (default: large-v3, turbo)

Install from Source

  1. install rye

  2. git clone https://github.com/Areopaguaworkshop/wenbi.git

cd wenbi 

mv pyproject.toml pyproject-bk.toml

rye init 

  1. copy whole content of the pyproject-bk.toml into pyproject.toml

source .venv/bin/activate

rye pin 3.12

rye sync

:warning: Again, you may face some package issues. you can either install the depencies one by one in the pyproject-bk.toml, or add llvmlite and numba first by rye add llvmlite numba , then install wenbi.

  1. You can choose commandline or webGUI through gradio.
  • gradio

python wenbi/main.py

Then go to http://localhost:7860.

  • commandline

'python wenbi/cli.py --help'

:warning: if you want to convert the audio file of multi-language, you should set multi-language as True. for commandline is --multi-language. you nedd a HUGGINGFACE_TOKEN in you environment. by export HUGGINGFACE_TOKEN="you HUGGINGFACE_TOKEN here".

Enjoy!

Buy me a Cofee.

License:

AI-Subtitle-Editor is licensed under the Apache License 2.0 found in the LICENSE file in the root directory of this repository.

Citation:

  title = {wenbi},
  author = {Ephrem, Yuan},
  year = {2024},
}

Project details


Download files

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

Source Distribution

wenbi-0.140.67.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

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

wenbi-0.140.67-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file wenbi-0.140.67.tar.gz.

File metadata

  • Download URL: wenbi-0.140.67.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.1

File hashes

Hashes for wenbi-0.140.67.tar.gz
Algorithm Hash digest
SHA256 157127963b9e5b714e37814d7418686196a3974ce8a87e18a3e91fedc9c38c4d
MD5 9eb9f6146726a5649c900936af923e1c
BLAKE2b-256 bf1446c5ee0f7fb56f591786e0d3bc16e227f73bcf91c7b8bdf91a2b6153aacf

See more details on using hashes here.

File details

Details for the file wenbi-0.140.67-py3-none-any.whl.

File metadata

  • Download URL: wenbi-0.140.67-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.1

File hashes

Hashes for wenbi-0.140.67-py3-none-any.whl
Algorithm Hash digest
SHA256 997c4afaf0a0e385d4f9bbe62a92cbd3fb2d21d8f89da9181a15bc58319c81a2
MD5 3c9707b1ff4dadf9f956c10dbb96bce1
BLAKE2b-256 a0c21510008a47af19e5f9903966ee2ec2e0b2ea4a5695abe3fd5e6d2a676d6e

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