We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ff2cf24 + c426c7d commit be06a8fCopy full SHA for be06a8f
src/huggingface_inference_toolkit/webservice_starlette.py
@@ -1,3 +1,4 @@
1
+import base64
2
import os
3
from pathlib import Path
4
from time import perf_counter
@@ -95,6 +96,14 @@ async def predict(request):
95
96
f"Body needs to provide a inputs key, received: {orjson.dumps(deserialized_body)}"
97
)
98
99
+ # Decode inputs conditioned on the task.
100
+ if "parameters" in deserialized_body and HF_TASK in {
101
+ "automatic-speech-recognition"
102
+ }:
103
+ deserialized_body["inputs"] = base64.b64decode(
104
+ deserialized_body["inputs"]
105
+ )
106
+
107
# check for query parameter and add them to the body
108
if request.query_params and "parameters" not in deserialized_body:
109
deserialized_body["parameters"] = convert_params_to_int_or_bool(
0 commit comments