Skip to content

Commit 9c5e3e5

Browse files
authored
Merge pull request #118 from huggingface/fix-audio-base64
Add missing base64 decoding for `audio-classification`
2 parents be06a8f + cb6b427 commit 9c5e3e5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/huggingface_inference_toolkit/webservice_starlette.py

Lines changed: 3 additions & 2 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.
99+
# Decode base64 audio inputs before running inference
100100
if "parameters" in deserialized_body and HF_TASK in {
101-
"automatic-speech-recognition"
101+
"automatic-speech-recognition",
102+
"audio-classification",
102103
}:
103104
deserialized_body["inputs"] = base64.b64decode(
104105
deserialized_body["inputs"]

0 commit comments

Comments
 (0)