Skip to content

Commit 14ca134

Browse files
authored
Merge pull request #23 from isabelizimm/run-ports
port/host to `.run()`
2 parents 39e96ad + 3da40e9 commit 14ca134

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

vetiver/server.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,9 @@ def __init__(
3737
self,
3838
model: VetiverModel,
3939
check_ptype: bool = True,
40-
port: Optional[int] = 8000,
41-
host="127.0.0.1",
4240
app_factory=FastAPI,
4341
) -> None:
4442
self.model = model
45-
self.port = port
46-
self.host = host
4743
self.check_ptype = check_ptype
4844
self.app_factory = app_factory
4945
self.app = self._init_app()
@@ -152,10 +148,13 @@ async def custom_endpoint(input_data: Request):
152148

153149
return {endpoint_name: new.tolist()}
154150

155-
def run(self):
151+
def run(self,
152+
port: int = 8000,
153+
host: str = "127.0.0.1",
154+
**kw):
156155
"""Start API"""
157156
_jupyter_nb()
158-
uvicorn.run(self.app, port=self.port, host=self.host)
157+
uvicorn.run(self.app, port=port, host=host, **kw)
159158

160159
def _custom_openapi(self):
161160
if self.app.openapi_schema:

0 commit comments

Comments
 (0)