Skip to content

Commit

Permalink
Fix JSON parsing before it gets passed to predict (#865)
Browse files Browse the repository at this point in the history
(cherry picked from commit f8ad61f)
  • Loading branch information
vishalbollu committed Mar 12, 2020
1 parent 45c7433 commit 5389974
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/workloads/cortex/serve/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import threading
import math
import asyncio
from typing import Union, Any
from typing import Any

from fastapi import FastAPI
from fastapi import Body, FastAPI
from fastapi.exceptions import RequestValidationError
from starlette.requests import Request
from starlette.responses import Response
Expand Down Expand Up @@ -147,7 +147,7 @@ def apply_cors_headers(request: Request, response: Response):


@app.post("/predict")
def predict(request: Union[dict, list, Any], debug=False):
def predict(request: Any = Body(..., media_type="application/json"), debug=False):
api = local_cache["api"]
predictor_impl = local_cache["predictor_impl"]

Expand Down

0 comments on commit 5389974

Please sign in to comment.