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)
| 179 | |
| 180 | |
| 181 | def _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 | |
| 201 | def _display_jupyter( |