Coder Social home page Coder Social logo

morechanger / gpt-subtitle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hqwuzhaoyi/gpt-subtitle

0.0 0.0 0.0 87.05 MB

Home Page: https://gpt-subtitle-web.vercel.app

License: MIT License

Shell 0.70% JavaScript 2.91% Rust 0.06% TypeScript 95.09% CSS 0.47% Dockerfile 0.78%

gpt-subtitle's Introduction

GPT-Subtitle ๐Ÿ’ฌ ๐ŸŒ

Build & Test FOSSA Status

English | ็ฎ€ไฝ“ไธญๆ–‡

whisper_preview

View Current Development Task ๐Ÿ“‹

GPT-Subtitle combines Whisper and OpenAIโ€™s GPT-3 Language Model ๐Ÿง , offering you local translation functionality for audio and video. It not only translates subtitles into dialogues but also supports multiple language translations and allows you to conveniently translate subtitles into other languages. ๐Ÿ›ฐ๏ธ

โœจ Key Features:

By integrating the whisper.cpp model, you can now:

  • Scan videos and audios in a folder and convert them into srt subtitle files ๐Ÿ” ๐ŸŽž๏ธ ๐ŸŽง
  • Utilize optimization algorithms to translate multi-language subtitle files ๐Ÿ’ฌ ๐ŸŒ

๐Ÿ”ง Tech Stack

  • NextJS 13 (App Router)
  • NestJS
  • Jotai
  • Framer Motion
  • Radix UI
  • Socket.IO
  • TailwindCSS

Running Environment

This project runs on the Node.js platform, so you need to install Node.js on your local machine first. After installation, open your command-line tool, navigate to the project root directory, and install pnpm and the necessary dependencies:

pnpm install

Install ffmpeg, please install it yourself for other systems

brew install ffmpeg

Also need to install redis and mysql, please install other systems by yourself

brew install redis
brew install mysql

Usage

Setting up API KEY

Before using the translation feature, you need to register an account on the OpenAI official website and apply for an API KEY. After obtaining the API KEY, you can copy a .env file from .env.template in the root directory and add the following configuration:

# Frontend Setting
NEXT_PUBLIC_API_URL=http://localhost:3001 # Backend API address
WEB_PORT=3000                             # Frontend start port

# Backend Setting
OPEN_AUTH=true            # Whether to enable authentication
OPENAI_API_KEY=           # OpenAI API KEY
GOOGLE_TRANSLATE_API_KEY= # Google API KEY(Can be left blank)
BASE_URL=                 # OpenAI API URL

## Database Setting
REDIS_PORT=6379             # Redis port
REDIS_HOST=subtitle_redis   # Redis address
MYSQL_HOST=subtitle_mysql   # MySQL address
MYSQL_PORT=3306             # MySQL port
MYSQL_USER=root             # MySQL user
MYSQL_PASSWORD=123456       # MySQL passowrd
MYSQL_DATABASE=gpt_subtitle # MySQL Database name

## Server Address Setting
SERVER_PORT=3001 # Backend start port

## System Setting. You can edit in Setting
OUTPUT_SRT_THEN_TRANSLATE=true # Whether to output the SRT file first and then translate it
TranslateModel=google          # google or gpt3
LANGUAGE=zh-CN                 # Output SRT file and then translate the language
TRANSLATE_DELAY=1500           # Delay between calling translation interface
TRANSLATE_GROUP=4              # Translate sentences for grouping translation, how many sentences can be translated at most at a time

Replace your_api_key with your own API key.

Running the Program

Deploy the service locally:

npm run deploy:prod

๐Ÿณ Docker Deployment

๐Ÿ“š Using docker-compose

  1. Change the arguments inside docker-compose.yml

    args:
         - WEB_PORT=3000
         - SERVER_PORT=3001
         - NEXT_PUBLIC_API_URL=http://localhost:3001
    
  2. Run the command

    docker-compose up -d

setup-whisper

The larger the model, the better the translation effect, but the slower it is. It is recommended to use the large model for languages other than English.

Nvidia GPU can accelerate the operation of models, but CUDA needs to be installed. For details, see whisper project instructions.

gpt-subtitle's People

Contributors

hqwuzhaoyi avatar dependabot[bot] avatar github-actions[bot] avatar mortalzhang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.