Flatten package layout and add Gitea CI
This commit is contained in:
62
.gitea/workflows/ci.yml
Normal file
62
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
backend:
|
||||
name: Backend
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: https://github.com/actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install backend dependencies
|
||||
working-directory: backend
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -e .[dev]
|
||||
python -m pip install build
|
||||
|
||||
- name: Test backend
|
||||
working-directory: backend
|
||||
run: python -m pytest
|
||||
|
||||
- name: Build backend package
|
||||
working-directory: backend
|
||||
run: python -m build
|
||||
|
||||
cli:
|
||||
name: CLI
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: https://github.com/actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install CLI dependencies
|
||||
working-directory: cli
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -e .[dev]
|
||||
python -m pip install build
|
||||
|
||||
- name: Test CLI
|
||||
working-directory: cli
|
||||
run: python -m pytest
|
||||
|
||||
- name: Build CLI package
|
||||
working-directory: cli
|
||||
run: python -m build
|
||||
33
README.md
33
README.md
@@ -1,11 +1,15 @@
|
||||
# whisper-remote
|
||||
|
||||
Two separate Python packages live in this repo:
|
||||
A split repo for running the upstream `openai/whisper` CLI remotely.
|
||||
|
||||
Two separate Python packages live here:
|
||||
|
||||
- `backend/`: FastAPI wrapper around the upstream `whisper` CLI
|
||||
- `cli/`: local `whisper-remote` command that forwards work to the remote API
|
||||
|
||||
## Backend
|
||||
The repo also includes a Gitea Actions workflow at `.gitea/workflows/ci.yml` that tests and builds both packages on pushes to `main` and pull requests.
|
||||
|
||||
## Backend setup
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
@@ -15,13 +19,34 @@ uvicorn whisper_remote_backend.server:app --host 0.0.0.0 --port 8000
|
||||
|
||||
The backend machine must already have the upstream `whisper` CLI available on `PATH`.
|
||||
|
||||
## CLI
|
||||
## CLI setup
|
||||
|
||||
```bash
|
||||
cd cli
|
||||
pip install -e .
|
||||
whisper-remote ./audio.mp3 --model base --language en --output-format txt
|
||||
```
|
||||
|
||||
PowerShell:
|
||||
|
||||
```powershell
|
||||
$env:WHISPER_REMOTE = "http://your-server:8000"
|
||||
whisper-remote .\audio.mp3 --model base --language en --output-format txt
|
||||
```
|
||||
|
||||
Bash:
|
||||
|
||||
```bash
|
||||
export WHISPER_REMOTE=http://your-server:8000
|
||||
whisper-remote ./audio.mp3 --model base --language en --output-format txt
|
||||
```
|
||||
|
||||
By default the CLI prints the transcript to stdout. Use `--to-file` to save the returned transcript locally.
|
||||
## Supported v1 options
|
||||
|
||||
- model selection
|
||||
- language forwarding
|
||||
- transcript output formats: `txt`, `vtt`, `srt`, `tsv`, `json`
|
||||
- file upload to the backend
|
||||
- backend-side cleanup of uploaded and generated files after each request
|
||||
|
||||
By default the CLI prints the returned transcript to stdout. Use `--to-file` to save it locally.
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
FastAPI wrapper around the upstream `whisper` CLI from `openai/whisper`.
|
||||
|
||||
Package layout is flat in this folder: `whisper_remote_backend/server.py`.
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
@@ -21,3 +23,8 @@ Multipart form fields:
|
||||
- `output_format`: `txt`, `vtt`, `srt`, `tsv`, or `json`
|
||||
|
||||
The response body is the transcript artifact itself. The backend deletes the uploaded file and generated output after each request.
|
||||
|
||||
## Notes
|
||||
|
||||
- The backend host must already have the upstream `whisper` command on `PATH`.
|
||||
- The included Gitea Actions workflow runs backend tests and package builds automatically.
|
||||
|
||||
@@ -22,9 +22,3 @@ dev = [
|
||||
"httpx>=0.28.0,<1.0.0",
|
||||
"pytest>=8.3.0,<9.0.0",
|
||||
]
|
||||
|
||||
[tool.setuptools]
|
||||
package-dir = {"" = "src"}
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Local CLI that forwards media files to a remote `whisper-remote-backend` server.
|
||||
|
||||
Package layout is flat in this folder: `whisper_remote_cli/main.py`.
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
@@ -10,4 +12,11 @@ export WHISPER_REMOTE=http://127.0.0.1:8000
|
||||
whisper-remote ./audio.mp3 --model base --language en --output-format txt
|
||||
```
|
||||
|
||||
Use `--to-file` to save the returned transcript locally.
|
||||
PowerShell:
|
||||
|
||||
```powershell
|
||||
$env:WHISPER_REMOTE = "http://127.0.0.1:8000"
|
||||
whisper-remote .\audio.mp3 --model base --language en --output-format txt
|
||||
```
|
||||
|
||||
Use `--to-file` to save the returned transcript locally. Without it, the CLI prints the transcript body to stdout.
|
||||
|
||||
@@ -19,9 +19,3 @@ dev = [
|
||||
|
||||
[project.scripts]
|
||||
whisper-remote = "whisper_remote_cli.main:main"
|
||||
|
||||
[tool.setuptools]
|
||||
package-dir = {"" = "src"}
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SRC = ROOT / "src"
|
||||
|
||||
if str(SRC) not in sys.path:
|
||||
sys.path.insert(0, str(SRC))
|
||||
Reference in New Issue
Block a user