Skip to content

Commit 5b27a78

Browse files
authored
add host to PymiloServer constructor - enabling accessiblity on LAN (#213)
* add host to `PymiloServer` constructor - enabling accessiblity on LAN * `CHANGELOG.md` updated * `README.md` updated * `CHANGELOG.md` updated * remove last sentence
1 parent 69f3bc6 commit 5b27a78

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
## [Unreleased]
88
### Added
99
### Changed
10+
- `README.md` updated
11+
- `__init__` function in `PyMiloServer`
1012
- Test system modified
1113
### Removed
1214
- Python 3.6 support

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ communicator.run()
175175
```
176176
Now `PymiloServer` runs on port `8000` and exposes REST API to `upload`, `download` and retrieve **attributes** either **data attributes** like `model._coef` or **method attributes** like `model.predict(x_test)`.
177177

178+
ℹ️ By default, `PymiloServer` listens on the loopback interface (`127.0.0.1`). To make it accessible over a local network (LAN), specify your machine’s LAN IP address in the `host` parameter of the `PymiloServer` constructor.
179+
178180
#### Client
179181
By using `PymiloClient` you can easily connect to the remote `PymiloServer` and execute any functionalities that the given ML model has, let's say you want to run `predict` function on your remote ML model and get the result:
180182
```python

pymilo/streaming/pymilo_server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def __init__(
1515
self,
1616
model=None,
1717
port=8000,
18+
host="127.0.0.1",
1819
compressor=Compression.NULL,
1920
communication_protocol=CommunicationProtocol.REST,
2021
):
@@ -25,6 +26,8 @@ def __init__(
2526
:type model: any
2627
:param port: the port to which PyMiloServer listens
2728
:type port: int
29+
:param host: the url to which PyMilo Server listens
30+
:type host: str
2831
:param compressor: the compression method to be used in client-server communications
2932
:type compressor: pymilo.streaming.compressor.Compression
3033
:param communication_protocol: The communication protocol to be used by PymiloServer
@@ -34,7 +37,7 @@ def __init__(
3437
self._model = model
3538
self._compressor = compressor.value
3639
self._encryptor = DummyEncryptor()
37-
self.communicator = communication_protocol.value["SERVER"](ps=self, port=port)
40+
self.communicator = communication_protocol.value["SERVER"](ps=self, host=host, port=port)
3841

3942
def export_model(self):
4043
"""

0 commit comments

Comments
 (0)