Skip to main content

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.subtitle_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:

  • translated_subtitle_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.subtitle_file = "subtitle.srt"
gst.translated_subtitle_file = "translated_subtitle.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


Download files

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

Source Distribution

gemini_srt_translator-1.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

gemini_srt_translator-1.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file gemini_srt_translator-1.1.0.tar.gz.

File metadata

  • Download URL: gemini_srt_translator-1.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for gemini_srt_translator-1.1.0.tar.gz
Algorithm Hash digest
SHA256 70b421bd0c38129776c407d9fd4ad2213acd3b076a9af0638a92bc07b96a9be8
MD5 a6650cd217b69adb077759b8df7ccce3
BLAKE2b-256 90c50193cac41071e735b538d8ccdd85f0dc46e50ee66a2e16cc5821a334ea94

See more details on using hashes here.

File details

Details for the file gemini_srt_translator-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gemini_srt_translator-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b53c31f977f4da6b08f85ea1c28a969257b039ff693a3f87cbe8e8e193f1ff5
MD5 6b6da0196f1e2498d944aca72532e0ac
BLAKE2b-256 365c7c2ab61ad051737fe3dd28382b4502b94190581eaab5265318979be7725a

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