Skip to content

Commit b009dbc

Browse files
committed
default accept env var
Signed-off-by: Raphael Glon <[email protected]>
1 parent 20153a7 commit b009dbc

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
@@ -111,9 +111,10 @@ async def predict(request):
111111
)
112112

113113
# response extracts content from request
114-
accept = request.headers.get("accept", None)
114+
accept = request.headers.get("accept")
115115
if accept is None or accept == "*/*":
116-
accept = "application/json"
116+
accept = os.environ.get("DEFAULT_ACCEPT", "application/json")
117+
logger.info("Request accepts %s", accept)
117118
# deserialized and resonds with json
118119
serialized_response_body = ContentType.get_serializer(accept).serialize(
119120
pred, accept

0 commit comments

Comments
 (0)