MCPcopy Create free account
hub / github.com/PAIR-code/lit / _display_colab

Function _display_colab

lit_nlp/notebook.py:181–198  ·  view source on GitHub ↗

Display the LIT UI in colab. Args: port: The port the LIT server is running on. height: The height of the LIT UI in pixels. open_in_new_tab: Whether to show the UI in a new tab instead of in the output cell. ui_params: RenderConfig of options for the LIT UI.

(port, height, open_in_new_tab, ui_params: RenderConfig)

Source from the content-addressed store, hash-verified

179
180
181def _display_colab(port, height, open_in_new_tab, ui_params: RenderConfig):
182 """Display the LIT UI in colab.
183
184 Args:
185 port: The port the LIT server is running on.
186 height: The height of the LIT UI in pixels.
187 open_in_new_tab: Whether to show the UI in a new tab instead of in the
188 output cell.
189 ui_params: RenderConfig of options for the LIT UI.
190 """
191
192 params = ui_params.get_query_str()
193 path = f'/{params}'
194
195 if open_in_new_tab:
196 output.serve_kernel_port_as_window(port, path=path)
197 else:
198 output.serve_kernel_port_as_iframe(port, height=f'{height}', path=path)
199
200
201def _display_jupyter(

Callers 1

renderMethod · 0.85

Calls 1

get_query_strMethod · 0.80

Tested by

no test coverage detected