Skip to content

Commit

Permalink
fix: allow bind projector server to host (#48)
Browse files Browse the repository at this point in the history
Co-authored-by: Han Xiao <han.xiao@jina.ai>
  • Loading branch information
abduhbm and hanxiao committed Jan 14, 2022
1 parent e022463 commit 2027672
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docarray/array/mixins/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ def plot_embeddings(
min_image_size: int = 16,
channel_axis: int = -1,
start_server: bool = True,
host: str = '127.0.0.1',
port: Optional[int] = None,
) -> str:
"""Interactively visualize :attr:`.embeddings` using the Embedding Projector.
:param title: the title of this visualization. If you want to compare multiple embeddings at the same time,
make sure to give different names each time and set ``path`` to the same value.
:param host: if set, bind the embedding-projector frontend to given host. Otherwise `localhost` is used.
:param port: if set, run the embedding-projector frontend at given port. Otherwise a random port is used.
:param image_sprites: if set, visualize the dots using :attr:`.uri` and :attr:`.blob`.
:param path: if set, then append the visualization to an existing folder, where you can compare multiple
Expand Down Expand Up @@ -224,12 +226,10 @@ def _get_fastapi_app():
port = port or random_port()
t_m = threading.Thread(
target=uvicorn.run,
kwargs=dict(app=app, port=port, log_level='error'),
kwargs=dict(app=app, host=host, port=port, log_level='error'),
daemon=True,
)
url_html_path = (
f'http://localhost:{port}/static/index.html?config={config_fn}'
)
url_html_path = f'http://{host}:{port}/static/index.html?config={config_fn}'
t_m.start()
try:
_env = str(get_ipython()) # noqa
Expand Down

0 comments on commit 2027672

Please sign in to comment.