Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

"on":
pull_request:
push:
branches:
- main
workflow_dispatch:

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
validate:
name: Lint, type-check, and tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Sync dependencies
run: uv sync --group dev

- name: Ruff
run: uv run ruff check .

- name: MyPy
run: uv run mypy src tests main.py h100_server.py

- name: Pytest
run: uv run pytest -q
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ Subtitle generation tools for live and archived streams. LiveVTT focuses on prod

### Requirements
- Python 3.10+
- `uv` CLI: used to sync and install dependencies.
- Install via `pip install uv` for Python environments.
- Or use `brew install uv` on macOS / Linux if available.
- See the official `uv` project page for more installation options: https://uv.run
- FFmpeg + FFprobe: FFprobe is included with FFmpeg. Download from the [official FFmpeg site](https://ffmpeg.org/download.html). Install via `apt install ffmpeg` (Linux), `brew install ffmpeg` (macOS), or `choco install ffmpeg` (Windows).

### Install dependencies
```bash
python -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
uv sync
```

### Transcribe archived media
Expand Down
4 changes: 2 additions & 2 deletions docs/CLOUD_GPU_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ On your current server with the video archive:

```bash
# Install new dependencies
poetry install
uv sync --no-dev

# Test connection to cloud GPU
curl http://YOUR_CLOUD_GPU_IP:8000/health
Expand All @@ -87,7 +87,7 @@ curl http://YOUR_CLOUD_GPU_IP:8000/health
### Step 3: Run Archive Transcription

```bash
poetry run python src/python/tools/archive_transcriber_remote.py \
uv run python src/python/tools/archive_transcriber_remote.py \
--remote-url http://YOUR_CLOUD_GPU_IP:8000 \
--workers 4 \
--progress \
Expand Down
11 changes: 3 additions & 8 deletions h100_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
import tempfile
from typing import Any, Iterable, Optional, Protocol, cast

from flask import Flask, jsonify, request # type: ignore
from faster_whisper import WhisperModel # type: ignore

from flask import Flask, jsonify, request # type: ignore

app: Flask = Flask(__name__) # type: ignore

Expand Down Expand Up @@ -46,9 +45,7 @@ def get_model(model_name: str = "large-v3-turbo") -> WhisperModel:
"""Get or load a Whisper model"""
if model_name not in MODELS:
print(f"Loading model: {model_name}", flush=True)
MODELS[model_name] = WhisperModel(
model_name, device="cuda", compute_type="float16"
)
MODELS[model_name] = WhisperModel(model_name, device="cuda", compute_type="float16")
print(f"Model loaded: {model_name}", flush=True)
return MODELS[model_name]

Expand All @@ -59,9 +56,7 @@ def parse_beam_size(value: Any) -> int:
except (TypeError, ValueError) as exc:
raise ValueError("beam_size must be an integer") from exc
if beam_size < MIN_BEAM_SIZE or beam_size > MAX_BEAM_SIZE:
raise ValueError(
f"beam_size must be between {MIN_BEAM_SIZE} and {MAX_BEAM_SIZE}"
)
raise ValueError(f"beam_size must be between {MIN_BEAM_SIZE} and {MAX_BEAM_SIZE}")
return beam_size


Expand Down
Loading
Loading