Skip to content

Commit 2bfb62f

Browse files
committed
Add missing base64 decoding for audio-classification
1 parent be06a8f commit 2bfb62f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/huggingface_inference_toolkit/webservice_starlette.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ async def predict(request):
9696
f"Body needs to provide a inputs key, received: {orjson.dumps(deserialized_body)}"
9797
)
9898

99-
# Decode inputs conditioned on the task.
100-
if "parameters" in deserialized_body and HF_TASK in {
101-
"automatic-speech-recognition"
99+
# Decode base64 audio inputs before running inference
100+
if "inputs" in deserialized_body and HF_TASK in {
101+
"automatic-speech-recognition",
102+
"audio-classification",
102103
}:
103104
deserialized_body["inputs"] = base64.b64decode(
104105
deserialized_body["inputs"]

0 commit comments

Comments
 (0)