Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Using system_logging_config directly instead of using Depends #858

Merged
merged 1 commit into from
Jan 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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