Skip to content

Implemented inputs decoding for compatibility with ASR task pipeline #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2025
Merged
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
9 changes: 9 additions & 0 deletions src/huggingface_inference_toolkit/webservice_starlette.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import base64
import os
from pathlib import Path
from time import perf_counter
Expand Down Expand Up @@ -95,6 +96,14 @@ async def predict(request):
f"Body needs to provide a inputs key, received: {orjson.dumps(deserialized_body)}"
)

# Decode inputs conditioned on the task.
if "parameters" in deserialized_body and HF_TASK in {
"automatic-speech-recognition"
}:
deserialized_body["inputs"] = base64.b64decode(
deserialized_body["inputs"]
)

# check for query parameter and add them to the body
if request.query_params and "parameters" not in deserialized_body:
deserialized_body["parameters"] = convert_params_to_int_or_bool(
Expand Down