Repository navigation
Description
Feature Summary
The HuggingFace inference operator (#5041) needs a small backend REST surface to support its frontend UI. Without these endpoints, the operator's property panel can't populate the model picker, audio-input tasks can't accept user uploads, and inference responses that link to remote media (images, audio, video on HF / Fal / Replicate CDNs) can't be previewed in the workspace due to browser CORS.
This issue covers introducing HuggingFaceModelResource and registering it on the web application. It is the backend foundation that subsequent child issues — the operator class, the property panel, result-panel media rendering, and developer docs — depend on.
Concretely, publishing these endpoints would enable:
- The operator UI's model picker (browse HF models per pipeline task; search by name).
- Audio uploads for tasks like automatic speech recognition and audio classification, with the uploaded clip streamable back to the browser for preview.
- Inline display of HF inference response media in the result panel, by proxying allowlisted remote URLs through Texera (bypassing browser CORS).
Proposed Solution or Design
- Add
HuggingFaceModelResource(Jersey REST resource,@Path("/huggingface")) exposing five endpoints:GET /api/huggingface/models?task=…[&search=…]— browse or search HF models for a pipeline task.GET /api/huggingface/tasks— list HF pipeline tags with hosted inference.POST /api/huggingface/upload-audio?filename=…— stream-upload an audio file.GET /api/huggingface/audio-preview?path=…— stream an uploaded audio file back to the browser.GET /api/huggingface/media-proxy?url=…— proxy an allowlisted remote media URL.
- Register the resource in
TexeraWebApplication. - Design constraints baked into the resource:
- Token sourcing: user's HF token forwarded via the
X-HF-Tokenrequest header from the operator panel; anonymous fallback for unauthenticated browsing. No server-side env-var token. - Caching: bounded Guava
Cache(size + 1 h TTL) for browse and tasks endpoints; user-token requests bypass the cache to keep private-model visibility per-user. - Streaming upload:
InputStream-based with a 25 MiB cap and extension allowlist (.wav,.mp3,.flac, …); non-audio extensions rejected before disk write. - SSRF protection: allowlist on
/media-proxy(huggingface.co,fal.media,replicate.delivery,replicate.com) with a leading-dot suffix guard against lookalike domains. - Bounded fan-out: the per-task probe in
/tasksruns on a dedicatedForkJoinPool(4)instead of the JVM common pool, with explicit 429/503 WARN logging. - Truncation visibility: browse and search responses carry an
X-Texera-Truncated: trueheader when a server-side cap is hit (MAX_PAGES=50for browse,SEARCH_LIMIT=100for search).
- Token sourcing: user's HF token forwarded via the
References:
- Parent issue: Add Hugging Face inference operator #5041
- Pull request: feat(huggingFace): add HuggingFaceModelResource for model browsing and media proxy #5124
- HF Hub API: https://huggingface.co/docs/hub/api
Impact / Priority
(P2) Medium – required for the HuggingFace inference operator (#5041) to function. Does not affect existing functionality.
Affected Area
Workflow Engine (Amber) — backend REST layer.
Task Type
- Refactor / Cleanup
- DevOps / Deployment / CI
- Testing / QA
- Documentation
- Performance
- Other
Activity
[-]Add `HuggingFaceModelResource` REST endpoints for HF operator UI[/-][+]Add HuggingFaceModelResource REST endpoints for HF operator UI[/+]feat(huggingFace): add HuggingFaceModelResource for model browsing an…
feat(huggingFace): add image task family via ImageTaskCodegen (apache…
feat(huggingFace): add HuggingFaceModelResource for model browsing an…
feat(huggingface): add audio and media generation tasks (apache#5570)
feat(huggingface): add qa and ranking tasks (apache#5574)
feat(huggingFace): add image task family via ImageTaskCodegen (apache…
feat(huggingface): add audio and media generation tasks (apache#5570)
feat(huggingface): add qa and ranking tasks (apache#5574)