Repository navigation
Feat/apps whisper fn - #40
KonstantinMKloster wants to merge 7 commits into
Conversation
…iption demo Rebuilds an always-on VM video-transcription demo as a STACKIT Function: downloads a video from S3, transcribes it with openai-whisper, writes the transcript back to S3, and scales to zero when idle instead of billing 24/7.
…ually runnable The fake imageio_ffmpeg path was a non-existent directory already named "ffmpeg", so handler.py's self-symlink step raised FileNotFoundError on every run. Point the stub at a real temp file instead.
Added email addresses for maintainers Konstantin Kloster and Dennis Gauss.
|
CI is still failing @KonstantinMKloster |
| echo " 4. Test locally without Docker/S3: python3 whisper-fn/test_handler_local.py" | ||
| echo " 5. When ready to deploy (creates billable STACKIT resources):" | ||
| echo " ./deploy.sh <project-id> <registry-image-ref> <registry-username>" | ||
| echo " 6. Using Claude Code? CLAUDE.md has all the context, including the" |
There was a problem hiding this comment.
Add your CLAUDE.md or AGENTS.md or remove such References
| Built via a hand-written `Dockerfile`, **not** `sfn functions build` | ||
| (Cloud Native Buildpacks) -- the buildpack output includes a zero-byte | ||
| metadata layer that this project's STACKIT Harbor registry rejects on | ||
| push. See `../DECISIONS.md`. |
There was a problem hiding this comment.
Remove or replace all references to missing files
| "outdated cli" against this project) | ||
| - `curl` | ||
| - A STACKIT project with Functions enabled, `Object Storage bucket`, and | ||
| `Container Registry` already set up (see below -- all three already exist |
There was a problem hiding this comment.
Remove "already exist for this project" as well as other such comments and write the docs for the readers environment. not yours
| if method == "GET" and path == "/health": | ||
| return await self._respond(send, 200, {"status": "ok", "model": MODEL_SIZE}) | ||
|
|
||
| if method == "POST" and path == "/transcribe": |
There was a problem hiding this comment.
Function URLs are public (https://docs.functions.onstackit.cloud/basics/concepts.html), so anyone who finds the URL can call it in a loop and run up cost. Please require a token from an env var, check Authorization: Bearer with hmac.compare_digest. Return 401 otherwise, and document it.
|
|
||
| MODEL_SIZE = os.environ.get("WHISPER_MODEL", "small") | ||
| S3_BUCKET = os.environ.get("S3_BUCKET") | ||
| S3_INPUT_KEY = os.environ.get("S3_INPUT_KEY", "elephants_dream.mp4") |
There was a problem hiding this comment.
Every call transcribes the same elephants_dream.mp4 and overwrites the same transcript, so this function only works as a demo. Please accept input_key / output_key in the JSON request body
| esac | ||
|
|
||
| echo "== Step 4/4: deploy (no --build/--push, image is already in the registry) ==" | ||
| sfn functions deploy --project-id "$PROJECT_ID" --env-file .env --no-interactive |
There was a problem hiding this comment.
The pull-secret step is also missing. Per the revision.yaml reference (https://docs.functions.onstackit.cloud/reference/revision-yaml.html), "the pinning will fail if e.g. the image is private and pull-credentials haven't been created yet". Please add the step, or check for an existing pull secret before deploying
| No `--build`/`--push` flags needed -- omitting them means "don't rebuild, | ||
| don't repush," since the image is already in the registry from step 5. | ||
| (Note: these are boolean switches, not `key=value` options -- | ||
| `--build=false` is a CLI parse error, just omit the flag entirely.) |
There was a problem hiding this comment.
The official custom functions how-to (https://docs.functions.onstackit.cloud/how-tos/create-custom-functions.html) uses exactly sfn function deploy --build=false --push=true --image …, and so does the Dockerfile header (Dockerfile:10-11). Please check and make GETTING-STARTED.md, the READMEs and the Dockerfile consistent
| # ships a static ffmpeg binary via pip instead, but under a versioned | ||
| # filename (e.g. "ffmpeg-linux-aarch64-v7.0.2"), not "ffmpeg" -- putting its | ||
| # directory on PATH alone isn't enough, so symlink it to the expected name. | ||
| _ffmpeg_exe = imageio_ffmpeg.get_ffmpeg_exe() |
There was a problem hiding this comment.
Move the ffmpeg symlink out of handler.py. It currently writes into site-packages at import time, which is why the Dockerfile needs RUN python -c "import handler" as root. Create it at build time instead
| license = "MIT" | ||
| dependencies = [ | ||
| "httpx", | ||
| "pytest", |
There was a problem hiding this comment.
Move pytest, pytest-asyncio and httpx out of the runtime dependencies, right now they needlessly end up in the image
| version = "0.1.0" | ||
| requires-python = ">=3.9" | ||
| readme = "README.md" | ||
| license = "MIT" |
Description
Checklist