The form has hard limits the doc didn't reflect:
- Title max 50 (was 70 β shortened to 46)
- Short desc max 255 (already fit at 126)
- Long desc max 2000 (was 2268 β trimmed to 1914)
All three code blocks now paste cleanly into the form without truncation.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
docs+pptx: refresh all submission deliverables to match shipping pipelineβ
Across all docs + the in-app Record-sign description, replaced outdated
references to:
- "samples 4 frames" β "video sent natively to Qwen3-VL via vLLM video_url"
- "Coqui XTTS-v2" β "gTTS"
- "Llama-3.1-8B" β "Qwen3-8B"
New: signbridge/scripts/build_pitch_deck.py β one-shot generator for
assets/pitch-deck.pptx (8 slides, 16:9, 38.5 KB) so the user can upload
directly to Google Slides or the lablab.ai submission form.
New: docs/USER_TODO.md β what only Lucas can do (record demo video,
fill submission form). Everything else (text, .pptx, cover image) is
already produced.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: load .env BEFORE importing signbridge β env-driven model name was always falling backβ
Bug: vlm.py reads SIGNBRIDGE_VLM_MODEL via os.getenv() at module-load
time. app.py was calling load_dotenv() inside main(), AFTER importing
signbridge.space (which transitively loads vlm.py). Result: the model
constant always defaulted to 'Qwen/Qwen3-VL-32B-Instruct' regardless
of .env contents β and the deployed AMD endpoint serves
'signbridge-qwen3vl-8b-asl', so every VLM call returned 404 NotFound.
Fix: hoist load_dotenv() above the signbridge import. One-line move.
Also: added debug prints in _on_snapshot to confirm handler reaches
the right branch (β added / β dropped / β no hand) β verified locally
that the Python side returns the correct status string for all three
cases. The "Latest result panel not visible in DOM" issue is being
debugged separately (component is in Gradio config but not in rendered
DOM β see end-to-end debug plan).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat: Record sign uses Qwen3-VL native video_url (instead of frame sampling)β
Live-tested 2026-05-10 against the deployed signbridge-qwen3vl-8b-asl
endpoint at port 8000. Pipeline:
webm β ffmpeg (480p, 8fps, β€4s, H.264) β base64 β video_url block
Why ffmpeg first: vLLM's opencv backend fails on VP8/VP9 webm metadata
(returns nonsense total_num_frames, Qwen3VLProcessor errors). Why the
downscale: model's max_model_len=8192 β 1080p videos overflow the
budget. 480p@8fpsΓ4s β 1680 prompt tokens, comfortable headroom.
Validation:
- Test 1: webm direct β 400 BadRequest (codec issue confirmed)
- Test 2: ffmpeg-mp4, real ASL recording β 200, returned 'M'
- Test 3: yt-test-video w/ subtitles β 'MYNAMEIS' (model OCRing burned-in caption)
- Test 4: same video cropped to remove subtitles β 'thank_you' (real ASL motion read)
- Crop verified: model description on cropped frame mentions hand gesture, no text
Frame-sampling path (recognize_sign_from_frames) preserved as fallback.
NEEDED: SIGNBRIDGE_VLM_MODEL=signbridge-qwen3vl-8b-asl in local .env
and HF Space Secrets β reβ¦
The CSS rules in _WEBCAM_BUTTON_LABEL_CSS were causing two visible bugs:
1. The button[aria-label*="record"]::after rule injected " Start" onto
Gradio's record/stop button regardless of state. Webcam.svelte uses
a static aria-label="start recording" β recording state lives only
on the inner div title, not the button β so the Stop selector never
matched and "Start" appeared mid-recording.
2. The .controls button { min-width: 80px } rule stretched Gradio's
stock post-record icon buttons (Re-record + Confirm) into oversized
broken-looking blocks.
Removed both rule blocks. Kept .signbridge-webcam-help (info box) and
.signbridge-webcam-snapshot .source-selection (hide camera dropdown).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ux: Record sign tab β wrap content in 3:2 columns to stop bottom-cropβ
The 1280x720 source from commit bcc09c0 still got ~37% of vertical
pixels cropped because the gr.Video container was full viewport
width (~1500px) with height=420 β 3.5:1 aspect, far wider than 16:9.
Mirror the Snapshot tab layout: video + submit in a scale=3 column
on the left, intro text + how-it-works + Latest result status in
a scale=2 column on the right. Container becomes ~60% width
(~900px), aspect ~2.14:1 β much closer to 16:9 source β drops
crop to ~17% (matches Snapshot tab framing).
Component identities preserved so submit_video_btn.click(...) and
_handle_video stay wired identically.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
User reported the Record sign tab's webcam preview was cut off at the
bottom (head only, no chest). Cause: the global getUserMedia hijack
forced 640x480 (4:3) for both tabs, and gr.Video's wide container
cropped top+bottom of the 4:3 source to fill width.
Snapshot tab keeps its 640x480 cap (small uploads, reliable on HF).
Record sign tab gets 1280x720 (16:9) β matches the wide container,
no crop, more pixels for the recognizer.
Detection via aria-selected tab role: regex /record sign/i on the
active tab's text content. Defaults to 640x480 if detection misfires.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ux: move 'Latest result' banner to right column as labeled gr.Markdownβ
The gr.HTML attempt (commit 9be688b) was still invisible on the deployed
Space β the inline-styled <div> apparently rendered into a wrapper that
collapsed or got hidden. Two prior attempts with gr.Markdown also failed
(empty value invisible / external CSS via elem_id didn't apply).
This switch uses gr.Markdown with a label= argument, placed in the
right column directly under the captured-signs history. Gradio's
labeled-component default styling guarantees a visible header + box,
no inline CSS or elem_id selectors required.
- β added `X` (87%) on accept
- β dropped `X` (62%) ... on borderline conf
- β no hand detected on missing hand
Plus alternatives: ` X (60%), Y (30%), Z (10%) ` from the MLP top-3
on every prediction.
Drops _LATEST_PLACEHOLDER_HTML constant and the inline-styled _html_box
helper β both now dead.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chore: clean up stale CSS comment from gr.Markdown eraβ
gr.Markdown + external CSS via elem_id wasn't rendering visibly on the
Space (CSS may have been cache-stale or the elem_id wrapped a level
removed from where the selector matched). Switch to gr.HTML with
inline styles directly in the value string β no CSS dependency, no
elem_id resolution needed.
Three states with color-coded borders:
- β added (green left border)
- β dropped (red left border)
- β no hand detected (red left border)
Default placeholder shown until first capture. Clear button resets to
the placeholder.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ux: make per-click status banner highly visible (bordered, labeled)β
User reported "no where mentioned dropped" β the latest gr.Markdown was
updating with β dropped / β added text but as an unlabeled empty blob
below the Clear button it was easy to miss.
- Added elem_id="signbridge-latest-status" + matching CSS (bordered,
indigo accent, min-height) so the banner is always visible.
- Default placeholder text so the box appears even before first click.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ux: always show prediction + βadded/βdropped status, never silentβ
Per-click status now always shows:
- β added `X` (87%) β accepted into history
- β dropped `X` (62%) β predicted but below 0.75 conf threshold; not added
- β no hand detected β MediaPipe couldn't find a hand at all
Plus top-3 alternatives in every case where a prediction was made.
Previously a low-conf drop was silent (just a generic "couldn't recognise"
message), so the user couldn't tell if their sign was wrong, blurry, or
just borderline.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: cap webcam to 640x480 + delay JS auto-access β stop ClientDisconnect stormβ
HF Space was still hitting ClientDisconnect on every snapshot upload.
Two root causes from inspecting gradio's stream_utils.ts and Webcam.svelte:
1. Gradio 4.44.1 hardcodes getUserMedia at {ideal: 1920x1440}. On HF
Spaces' proxy, the resulting ~1-2MB PNG upload takes long enough
that the connection gets killed mid-multipart.
2. The auto-access JS was firing every 300ms β racing the in-flight
upload XHR (Webcam.svelte sets webcam_accessed=false immediately on
capture click, so the access placeholder appears BEFORE upload
completes; auto-clicking it triggers a new getUserMedia β new
stream β re-render that aborts the upload).
Fix:
- Monkey-patch navigator.mediaDevices.getUserMedia at app load to
cap video constraints at 640x480 (~50-100KB PNG, uploads in <1s).
- Throttle the auto-access click to once per 1.5s and tick at 500ms
so the upload XHR has time to establish before re-engaging webcam.
- Defensive server-side downscale to 720px max for any frames that
soβ¦
feat: gTTS as primary TTS β Coqui XTTS-v2 was never installed on Spaceβ
The HF Space had been emitting silent-stub WAV for every Speak click
because the local Coqui TTS package isn't in requirements (2GB+ install
+ slow CPU inference + the XTTS-via-AMD path was promised in a comment
but never wired). Switch to gTTS β Google's free TTS, tiny dep, real
audio in <1s.
Three-tier fallback:
1. Coqui XTTS-v2 if installed locally (best quality, slow).
2. gTTS β fast cloud TTS, free, MP3 output.
3. Silent stub β last resort so gradio Audio doesn't error.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
HF Space logs were full of starlette.requests.ClientDisconnect on the
upload_file endpoint: every gradio .stream() frame upload was getting
chopped before completion. Result: stash_count=0 forever, capture
button always saw frame_present=False, recognition never fired on the
deployed Space (worked fine locally on unlimited bandwidth).
Switch:
- gr.Image now non-streaming (one upload per click).
- webcam.change() handler runs recognition + auto-clears the value so
the Webcam component re-mounts.
- New JS auto-clicks the "Click to Access Webcam" placeholder after
the first user-gesture grant β browser remembers permission, so
per-letter UX stays one click.
- Confidence threshold raised to 0.75 + show top-3 alternatives in
the status text so users can see ambiguity ("U 65%, R 29%").
- Recognition path now logs MediaPipe hand detection result + MLP
top-3 + composer/TTS calls end-to-end.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: webcam stream actually fires + JS auto-arms record toggleβ
Root cause: gradio 4.44.1's gr.Image(streaming=True) only dispatches
.stream() events while the user is actively "recording" (Webcam.svelte
gates take_picture on `recording=true`). We had hidden the record
toggle via CSS, so the stream never started and _stash_frame never ran.
Fixes:
- Inject JS that polls for the (hidden) record button and clicks it
once per mount, flipping recording=true so frames flow.
- .stream() now wires to a hidden gr.Number sink β outputs=[] silently
disables the handler in 4.44.1.
- landmark_classifier: retry on transient HF download failure instead
of caching the failure forever, log full exception text + token state,
and fall back to anonymous fetch when the token call 404s.
- app.py: configure root logging so signbridge.* messages reach stdout.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: webcam capture β global cache, .change() event, drop share=Trueβ
Previous attempts at frame capture all failed because gradio 4.44.1
silently drops handlers whose signatures it can't introspect. Adding
a `gr.Request` parameter to a stream/change handler in particular
appears to trigger this. Also `outputs=None` may not wire the event.
This commit:
1. Replaces session-keyed `_frame_cache: dict[str, ndarray]` with a
single global `_latest_frame: ndarray | None`. Single-user demo;
per-session keying is over-engineering and bypasses the gr.Request
injection bug entirely.
2. Switches `webcam.stream()` β `webcam.change()` (canonical per-frame
handler in gradio 4.x for streaming components) and uses
`outputs=[]` instead of `None`.
3. Adds `_stash_count` debug counter + periodic log line so HF run
logs confirm the handler is actually firing.
4. Drops `share=True` from app.py β HF Spaces warns it's unsupported
and SYSTEM=spaces env var (in Dockerfile) is sufficient to bypass
gradio's _check_localhost pre-flight.
Local verified: _staβ¦
fix: global frame-cache so click handler can actually see live framesβ
Previous attempts:
1. streaming=False + click reads webcam β value is None unless user
explicitly clicks π· Take Photo (extra step we wanted to skip)
2. streaming=True + click reads webcam β value still None at click
time; gradio doesn't deliver streamed frames to click handlers
3. streaming=True + .stream() β state-stash β click reads state β
gradio 4.44.1 deep-copies State between handlers, mutations don't
persist across the .stream/.click boundary
This commit: streaming=True + .stream() β write to a module-level
dict keyed by gr.Request.session_hash β click reads from that dict.
Bypasses gradio's state serialization entirely. Threading.Lock around
reads/writes for safety; per-session keying so concurrent users don't
collide.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: read webcam directly on click instead of state-stashingβ
The .stream() β state-stash β click-read pattern looked clean but
gradio's session-state apparently isn't shared between concurrent
.stream() callbacks and a .click() handler β the click always saw a
state.latest_frame of None even while frames were arriving.
Reverting to the simple pattern: streaming=True, click handler takes
the webcam component as input. Gradio passes the most recent streamed
frame value on click. The earlier failure that drove us off this
pattern was actually the streaming=False case (where the value really
is None until a manual photo-capture); with streaming=True the value
tracks the live frames.
Removed _stash_frame and the latest_frame state field accordingly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
User feedback: after every recognition the camera was reset to the
"Click to Access Webcam" prompt, requiring repeated clicks per letter.
Switched the Snapshot tab to streaming=True. Once the user grants
camera permission (one time per session), the live preview stays on
indefinitely. A new .stream() handler (_stash_frame) continuously
stashes the most recent webcam frame on the gr.State object.
Two buttons in a row beneath the live preview:
- πΈ Take image β reads state.latest_frame, runs recognition,
appends to history. No camera reset.
- π§Ή Clear β wipes history + sentence + audio. Camera stays live.
Result: grant access once, sign-and-tap-Take-image per letter, no
permission re-prompts. Matches user's UX expectation exactly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ux: auto-dismiss photo after recognition so next capture is one tapβ
User feedback: after taking a photo and seeing the result, the photo
stayed frozen and required a manual dismiss before the next capture.
Now _capture_sign returns None for the webcam value on success/fail,
which auto-resets the component back to live-preview mode. The
ndarrayβNone transition triggers webcam.change again, and the handler
no-ops on a None frame (using gr.update() to keep current values for
the other outputs) β no infinite loop, no stale warning.
Net flow per letter: sign β π· Take Photo β (recognition + auto-reset
in ~1s) β live preview ready for next letter. Only the very first time
needs a webcam-permission grant (browser security; can't be skipped).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
User feedback: 3-button flow was confusing β people pressed Capture sign
before clicking Take Photo. Simplified to 2 buttons:
1. π· Take Photo (built into the Gradio Image webcam) β auto-fires
recognition via webcam.change() event. Photo IS the capture.
2. π§Ή Clear β resets webcam + history + sentence + audio.
Also removed the Pose-tracking debug accordion: it was a dev-time
visualization for MediaPipe Holistic landmarks (the legacy mp.solutions
API), which is now broken on Python 3.11+ and adds visual clutter for
judges. The production fingerspelling path uses the new MediaPipe
Tasks API in landmark_classifier.py and doesn't need the overlay.
Result: cleaner UX, fewer clicks, no broken-feature warnings.
26 gradio components (down from 31).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: Clear button now resets webcam too + accurate help-text labelsβ
1. Clear button only reset history/sentence/audio β the captured webcam
frame stayed visible. Added webcam to the click handler's outputs and
_clear() now returns 6 values (None for the image).
2. Help text was telling users to "click the red square to Stop" β but
with streaming=False the webcam takes a single Photo, there's no Stop
button. Rewrote the Snapshot tab help as a numbered 5-step flow:
Access webcam β sign β Take Photo β Capture sign β Speak.
3. Same fix for the Record-sign tab help: now describes the actual
record/stop/submit flow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: 4 Space runtime bugs found in line-by-line auditβ
1. streaming=True on gr.Image webcam meant button-click handlers got
None as the frame value β root cause of 'no webcam frame yet'.
Switched to streaming=False; user still sees live preview, and the
Capture click reliably delivers the current frame.
2. gradio 4.44.1 imports HfFolder from huggingface_hub, which is
removed in 0.30+. Pinned huggingface_hub>=0.26,<0.30.
3. Added text labels above the webcam (".signbridge-webcam-help" HTML
blocks) explaining Start / Stop / Capture flow for first-time users.
4. CSS pseudo-element labels on aria-labelled webcam-control buttons
so the start/stop icons inside the gradio Image component show
visible 'Start' / 'Stop' text.
Verified locally: build_demo() returns Blocks with 31 components, no
import errors with the pinned dep set (gradio 4.44.1 + starlette<0.41
+ huggingface_hub<0.30 + jinja2<3.2).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: libgles2/libegl1 in Dockerfile + handle missing mp.solutions namespaceβ
Two runtime errors observed on the live Space:
1. libGLESv2.so.2 missing β added libgles2 + libegl1 to apt-get install.
MediaPipe needs both the OpenGL and OpenGL ES variants on Linux.
2. AttributeError: module 'mediapipe' has no attribute 'solutions' β
MediaPipe 0.10.15+ deprecated the legacy `mp.solutions` namespace; the
Holistic solution moved to mediapipe-extended. Production fingerspelling
already uses the Tasks API (signbridge.recognizer.landmark_classifier),
so the Holistic-based pose-debug overlay is now optional. landmarks.py
handles the missing namespace gracefully β logs and returns early
instead of crashing the Space's import path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: pin starlette<0.41 β gradio 4.44.1 incompatible with new TemplateResponse signature
The "When localhost is not accessible" error is from
gradio.networking._check_localhost, which is short-circuited when
gradio sees os.environ['SYSTEM']=='spaces'. The HF gradio-SDK runtime
sets this automatically; the docker-SDK runtime does not, so we set it
both in the Dockerfile and as a defensive setdefault inside app.py.
Also: docs (CLAUDE.md progress log, walkthrough, pitch deck, lablab
submission form) updated to reflect the LoRA fine-tune win
(92.3% transformers eval, 54-min train on MI300X) and the hybrid
MediaPipe+MLP / fine-tuned-Qwen3-VL pipeline.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: switch to Docker SDK so Python + launch are fully under our controlβ
Gradio 4.44.1 + HF default Python 3.13 hit ModuleNotFoundError(pyaudioop)
because pyaudioop was removed from stdlib in 3.13 β and pydub (gradio's
audio dep) hardcodes that import. Pinning python_version to 3.10/3.11
exposed a separate gradio runtime issue ('localhost not accessible').
Switching to Docker SDK (python:3.11-slim) gives us:
- working pydub / gradio audio
- mediapipe wheel installs cleanly (no 3.13 wheel exists yet)
- explicit GRADIO_SERVER_NAME=0.0.0.0 and port 7860
- predictable layered build (cached pip install of requirements.txt)
app.py keeps its env-driven server_name/port for parity with the
Dockerfile defaults.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
HF Spaces rejects binary files >5MB without going through Xet/LFS, and
LFS migration of an already-pushed history triggers a force-push that's
not appropriate here. Cleaner pattern: host the weights on a public HF
model repo (LucasLooTan/signbridge-asl-classifier) and pull via
hf_hub_download on first call. Cached under HF_HOME so subsequent calls
are instant.
Override env vars (still supported):
- SIGNBRIDGE_LANDMARK_MLP_PATH β local .pt
- SIGNBRIDGE_HAND_LANDMARKER_PATH β local .task
- SIGNBRIDGE_CLASSIFIER_HF_REPO β alternative HF repo
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat: MediaPipe+MLP landmark classifier β 90% ASL fingerspelling accuracyβ
Trained on 8,639 hand-landmark vectors from the Marxulia ASL dataset.
3-layer MLP (63β256β256β128β26), AdamW + cosine schedule, 40 epochs.
Result: 88.0% test accuracy on a 1,727-image holdout, 90.4% on the
52-image Wikipedia-style gold set (vs 19.2% with Qwen3-VL alone β a
4.7x improvement).
The Snapshot tab + /recognize endpoint now run the landmark classifier
first (CPU, ~50ms) and only fall through to Qwen3-VL when MediaPipe
can't detect a hand or confidence is below 0.5. The Record-sign tab
still uses the multi-frame Qwen3-VL-32B path for motion signs since
those need temporal context.
HF Space pinned to Python 3.11 so the mediapipe wheel installs.
Removed `python_version<3.13` markers from requirements now that the
runtime is consistent across local + Space.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: websockets<13 to satisfy gradio-client 1.3.0 dep range
Both run on a single AMD MI300X via vLLM. Qwen3-VL-32B is the
accuracy ceiling that fits in 192 GB (Qwen3-VL-235B FP8 is 235 GB
which exceeds the GPU). Qwen3-8B replaces gated Llama-3.1-8B,
keeping the composer open-weights and the entire pipeline Qwen-family
for the Qwen Special Reward (10M tokens Γ team).
Composer adds extra_body={"chat_template_kwargs":{"enable_thinking":False}}
so Qwen3 reasoning models emit a sentence directly instead of <think>...</think>.
Adds SIGNBRIDGE_COMPOSER_BASE_URL/API_KEY so we can split the two
servers on different ports of the same MI300X (8000 for VL, 8001 for composer).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
docs: pitch deck + demo video script + lablab submission form contentβ
Three pure-content deliverables that don't depend on AMD Dev Cloud
credits being live β Lucas can paste these directly when ready.
- docs/pitch-deck.md β 8-slide deck, slide-by-slide content + visual
notes. Built around the four judging criteria. Closes on the
substrate-not-product framing.
- docs/demo-video-script.md β 2:30 shot list, voice-over script,
recording order, editing checklist, export checklist.
- docs/lablab-submission-form.md β copy-paste content for every
field on lablab.ai's submission form, with character counts
pre-validated and tags pre-selected.
docs(readme): tighten Why AMD + add For Deaf-led teams sectionβ
HF Space card now mirrors the walkthrough's substrate-not-product
framing and concrete MI300X-vs-H100 memory headroom story:
- 'Why AMD' replaced with a single tight paragraph: 192 GB HBM3 +
5.3 TB/s bandwidth fits the V2 70B-reasoner upgrade that NVIDIA
H100 cannot match without a 3-GPU cluster.
- New 'For Deaf-led teams' section between Privacy and Local dev,
pointing at docs/walkthrough.md β Deployment ethics for the full
Deaf-community engagement principles.
Adds three new sections to the technical walkthrough:
- 'Why AMD MI300X concretely' β comparison table vs H100 / H200,
showing single-GPU concurrency headroom for the V2 70B reasoner
upgrade.
- 'Deployment ethics' β three principles drawn from the Deaf-led
literature (Bragg et al. 2024, ASSETS 2025, privacy-aware SLT 2024).
- 'Future work' β academic foundations (SignCLIP, SL-SLR, trained
CSLR) we'd build on for V2.
Pre-empts the 'isn't this another tech-bro savior project?' critique
and lifts criterion-3 (Business Value) by being explicit about the
substrate-not-product framing.
fix: threading.Lock on LandmarkExtractor + composer prompt format matchβ
Two deep-check IMPORTANTs:
- B.F2 / A.F4: Gradio multi-threaded server can race the lazy
initialisation of _extractor_singleton; concurrent first-clicks
could build two MediaPipe instances. threading.Lock with
double-checked-locking pattern fixes it.
- C.F6: composer user prompt previously sent ', '.join(signs) while
the system prompt teaches the model with Python list syntax. Switch
user prompt to repr(list(signs)) so format matches examples β should
improve the 'My name is Lucas' hero demo.
feat(ui): Record-sign tab β multi-frame burst capture for full ASL wordsβ
Two-tab Gradio layout:
- Tab 1: existing snapshot mode for fingerspelled letters (A-Z, 0-9).
- Tab 2: 'Record sign' video capture; user records 1.5-2s of webcam,
presses Submit, and the app extracts 4 evenly-spaced frames via
OpenCV and POSTs them to recognize_sign_from_frames.
This lifts SignBridge from 'spells letters' to 'translates ASL words'
β the demo now handles motion-dependent signs (HELLO, THANK_YOU,
PLEASE, EAT, ...) which a single still frame fundamentally cannot
capture.
New _sample_frames_from_video helper uses cv2.CAP_PROP_FRAME_COUNT and
CAP_PROP_POS_FRAMES to fetch evenly-spaced frames; lazy-imports cv2
so the module still loads if opencv isn't available.
feat(backend): /recognize accepts frames list + body-size capβ
deep-check audit B.F3 + new feature:
- RecognizeRequest now accepts either 'frame' (single) or 'frames'
(list). Exactly one of the two must be provided; validator returns
4xx if both or neither are supplied.
- Per-frame base64 size cap of 3 MB (well above any reasonable webcam
frame) and per-burst frame-count cap of 12 β defends /recognize
against accidental DoS via huge payloads.
- Multi-frame path delegates to recognize_sign_from_frames; single-
frame path unchanged.
feat(vlm): add recognize_sign_from_frames for multi-image VLM inputβ
New function takes an ordered list of >=2 frames and sends them in a
single OpenAI-compatible chat-completions call with N image_url
entries plus the multi-frame prompt. Same vocab filter and confidence
semantics as the single-frame path; raises ValueError for <2 frames.
Enables the upcoming Hold-to-record demo flow that turns SignBridge
from a fingerspelling-only demo into one that handles motion ASL
signs (HELLO, THANK_YOU, PLEASE, EAT, ...) which a single still
frame fundamentally cannot capture.
Per the deep-research finding (NVIDIA Vision-Language-Model Prompt
Engineering Guide, March 2025): closed-vocabulary forcing + domain
priming + sequential frame markers. Builds ASL-specific prompts that
explicitly distinguish static fingerspelling from motion-dependent
lexical signs.
- Single-frame builder (build_single_frame_prompt) replaces the existing
inline _PROMPT in vlm.py. Adds the ASL domain-priming preface; same
closed-vocabulary forcing and output contract as before.
- Multi-frame builder (build_multi_frame_prompt) generates 'Frame 1:
... Frame N: ...' markers so the VLM treats the inputs as a temporal
sequence. Used by the upcoming Hold-to-record burst-capture pipeline
in Task 4.
perf: cache OpenAI-compatible client per (provider, model) tupleβ
deep-check audit A.F9: _resolve_client was instantiating a fresh
OpenAI client (and therefore a fresh httpx connection pool) per
recognition / composition call. lru_cache(maxsize=4) keyed on
(provider, base_url, api_key, model) reuses the pool across same-
provider calls; switching providers (e.g. amd -> hf fallback) rebuilds
cleanly.
Same pattern applied to both signbridge/recognizer/vlm.py and
signbridge/composer/sentence.py. Existing test monkey-patches still
work because they replace _resolve_client directly, not _build_client.
refactor: extract closed vocabulary into signbridge.vocab moduleβ
Single source of truth eliminates the drift risk between the VLM
recognizer (string-prompt vocab) and the trained-classifier head (list
order maps to logit indices). Also exports VOCAB_PROMPT_LITERAL for
prompt embedding and VOCAB_SET for membership checks.
Addresses deep-check finding A.F10 / D.F10 (vocab drift across modules).