From 55ff447dc34b758fffdf8f74fd3769c4a3980ec7 Mon Sep 17 00:00:00 2001 From: fedml-dimitris Date: Mon, 4 Nov 2024 14:31:37 -0500 Subject: [PATCH] Parameterizing deploy host, port. --- python/fedml/serving/fedml_inference_runner.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/fedml/serving/fedml_inference_runner.py b/python/fedml/serving/fedml_inference_runner.py index 30dd9a6fca..64a8a2d596 100644 --- a/python/fedml/serving/fedml_inference_runner.py +++ b/python/fedml/serving/fedml_inference_runner.py @@ -6,8 +6,10 @@ class FedMLInferenceRunner(ABC): - def __init__(self, client_predictor): + def __init__(self, client_predictor, host="0.0.0.0", port=2345): self.client_predictor = client_predictor + self.host = host + self.port = port def run(self): api = FastAPI() @@ -43,5 +45,4 @@ async def ready(): return Response(status_code=status.HTTP_202_ACCEPTED) import uvicorn - port = 2345 - uvicorn.run(api, host="0.0.0.0", port=port) + uvicorn.run(api, host=self.host, port=self.port)