Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/100percentbaka/srt-gen
https://github.com/100percentbaka/srt-gen
gradio grok whisper
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/100percentbaka/srt-gen
- Owner: 100percentBAKA
- License: mit
- Created: 2024-08-03T07:09:33.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-09-04T09:08:00.000Z (6 months ago)
- Last Synced: 2024-12-21T23:30:31.788Z (about 2 months ago)
- Topics: gradio, grok, whisper
- Language: Python
- Homepage: https://ad4r5hgs-srt-gen.hf.space
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SRT-GEN is a Simple Subtitle Maker
This project is a web-based application that allows users to generate subtitles (SRT files) for audio or video files using the Groq API and Whisper model. The application is built using Python and Gradio, making it easy to interact with the model and generate subtitles through a user-friendly interface.
## Features
- **Upload Audio/Video Files**: Users can upload audio or video files for subtitle generation.
- **Generate Subtitles**: With a single click, generate subtitles using the Whisper model provided by Groq.
- **Download SRT File**: After the subtitles are generated, the user can download the SRT file for further use.## Requirements
- Python 3.7+
- The following Python packages:
- `gradio`
- `groq`
- `python-dotenv`## Installation
1. **Clone the repository:**
```bash
git clone https://github.com/100percentBAKA/srt-gen.git
cd srt-gen
```2. **Install the required packages:**
```bash
pip install -r requirements.txt
```3. **Set up environment variables:**
- Create a `.env` file in the root directory.
- Add your Groq API key to the `.env` file:
```plaintext
GROQ_API_KEY=your_groq_api_key_here
```## Usage
1. **Run the application:**
```bash
python app.py
```2. **Access the interface:**
- Open a web browser and go to the URL provided by Gradio (usually `http://localhost:7860/`).
- Upload an audio or video file.
- Click "Generate Subtitles" to create an SRT file.3. **Download the SRT file:**
- Once the subtitles are generated, you can download the SRT file from the interface.## Code Explanation
- `format_time(seconds)`: Converts a time value in seconds to the SRT format (hours:minutes:seconds,milliseconds).
- `json_to_srt(transcription_json)`: Converts the transcription JSON from Groq into the SRT format.
- `generate_subtitles(input_file)`: Handles the entire process of reading the uploaded file, generating the transcription via the Groq API, converting it to SRT, and saving the file.
- The Gradio interface is built with `gr.Blocks`, allowing users to upload files, generate subtitles, and download the output.