@@ -106,12 +106,14 @@ def plot_embeddings(
106106 min_image_size : int = 16 ,
107107 channel_axis : int = - 1 ,
108108 start_server : bool = True ,
109+ host : str = '127.0.0.1' ,
109110 port : Optional [int ] = None ,
110111 ) -> str :
111112 """Interactively visualize :attr:`.embeddings` using the Embedding Projector.
112113
113114 :param title: the title of this visualization. If you want to compare multiple embeddings at the same time,
114115 make sure to give different names each time and set ``path`` to the same value.
116+ :param host: if set, bind the embedding-projector frontend to given host. Otherwise `localhost` is used.
115117 :param port: if set, run the embedding-projector frontend at given port. Otherwise a random port is used.
116118 :param image_sprites: if set, visualize the dots using :attr:`.uri` and :attr:`.blob`.
117119 :param path: if set, then append the visualization to an existing folder, where you can compare multiple
@@ -224,12 +226,10 @@ def _get_fastapi_app():
224226 port = port or random_port ()
225227 t_m = threading .Thread (
226228 target = uvicorn .run ,
227- kwargs = dict (app = app , port = port , log_level = 'error' ),
229+ kwargs = dict (app = app , host = host , port = port , log_level = 'error' ),
228230 daemon = True ,
229231 )
230- url_html_path = (
231- f'http://localhost:{ port } /static/index.html?config={ config_fn } '
232- )
232+ url_html_path = f'http://{ host } :{ port } /static/index.html?config={ config_fn } '
233233 t_m .start ()
234234 try :
235235 _env = str (get_ipython ()) # noqa
0 commit comments