Skip to content

Commit

Permalink
[Cherry Pick] Using system_logging_config directly instead of using D…
Browse files Browse the repository at this point in the history
…epends (#858) (1.4.2) (#973)

* Using system_logging_config directly instead of using Depends (#858)

* Update version.py

---------

Co-authored-by: corey-nm <109536191+corey-nm@users.noreply.github.com>
Co-authored-by: Benjamin Fineran <bfineran@users.noreply.github.com>
  • Loading branch information
3 people committed Mar 22, 2023
1 parent c391607 commit 22208e5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/deepsparse/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
SystemLoggingMiddleware,
log_system_information,
)
from fastapi import Depends, FastAPI, UploadFile
from fastapi import FastAPI, UploadFile
from starlette.responses import RedirectResponse


Expand Down Expand Up @@ -253,17 +253,13 @@ def _add_pipeline_endpoint(
input_schema = pipeline.input_schema
output_schema = pipeline.output_schema

async def endpoints_params():
# global parameters that will be passed to all the endpoints of the server
return {"system_logging_config": system_logging_config}

def _predict(request: pipeline.input_schema, params=Depends(endpoints_params)):
def _predict(request: pipeline.input_schema):
pipeline_outputs = pipeline(request)
server_logger = pipeline.logger
if server_logger:
log_system_information(
server_logger=server_logger,
system_logging_config=params.get("system_logging_config"),
system_logging_config=system_logging_config,
)
return pipeline_outputs

Expand Down

0 comments on commit 22208e5

Please sign in to comment.