A tool to translate subtitles using Google Generative AI
Project description
Gemini SRT Translator
Overview
Gemini SRT Translator is a tool designed to translate subtitle files using Google Generative AI. It leverages the power of the Gemini API to provide accurate and efficient translations for your subtitle files.
Features
- Translate subtitle files to a specified target language.
- Customize translation settings such as model name and batch size.
- List available models from the Gemini API.
Installation
To install Gemini SRT Translator, use pip:
pip install gemini-srt-translator
Usage
Translate Subtitles
You can translate subtitles using the translate
command:
import gemini_srt_translator as gst
gst.gemini_api_key = "your_gemini_api_key_here"
gst.target_language = "French"
gst.input_file = "subtitle.srt"
gst.translate()
This will translate the subtitles in the subtitle.srt
file to French.
Configuration
You can further customize the translation settings by providing optional parameters:
output_file
: Path to save the translated subtitle file.model_name
: Model name to use for translation.batch_size
: Batch size for translation.
Example:
import gemini_srt_translator as gst
gst.gemini_api_key = "your_gemini_api_key_here"
gst.target_language = "French"
gst.input_file = "subtitle.srt"
gst.output_file = "subtitle_translated.srt"
gst.model_name = "gemini-1.5-flash"
gst.batch_size = 30
gst.translate()
List Models
You can list the available models using the listmodels
command:
import gemini_srt_translator as gst
gst.gemini_api_key = "your_gemini_api_key_here"
gst.listmodels()
This will print a list of available models to the console.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gemini_srt_translator-1.1.2.tar.gz
.
File metadata
- Download URL: gemini_srt_translator-1.1.2.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fac6a7784973480fac35efae9a37324fc7ff2a3c86c56565e3b6b199e2f68486 |
|
MD5 | 85a39867168ed0f8f20a0ce47684c0af |
|
BLAKE2b-256 | 7600fa1c0c3113ae4d95d7ae6b4a5f4078ce76f2ed20148d72a322eb26eb35c3 |
File details
Details for the file gemini_srt_translator-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: gemini_srt_translator-1.1.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e68e1abd4880bd205178e5726ca1429f26ed179e7048a0a1b04c88cdeaa1bc01 |
|
MD5 | 3f687cbf033282ff86d77a414deb4674 |
|
BLAKE2b-256 | 87a3fe344c06a37a3d66f4396779bdb2e94daf8f8eac4d4077af2684ec80d750 |