Render the LIT UI in the output cell. To immediately analyze specifiic example(s), use the data= parameter: widget.render(..., data=[{"prompt": "Hello world "}]) Args: height: Optional height to display the LIT UI in pixels. If not specified, then the height specified i
(
self,
height=None,
open_in_new_tab=False,
ui_params: Optional[RenderConfig] = None,
data: Optional[Sequence[JsonDict]] = None,
)
| 146 | self._server.stop() |
| 147 | |
| 148 | def render( |
| 149 | self, |
| 150 | height=None, |
| 151 | open_in_new_tab=False, |
| 152 | ui_params: Optional[RenderConfig] = None, |
| 153 | data: Optional[Sequence[JsonDict]] = None, |
| 154 | ): |
| 155 | """Render the LIT UI in the output cell. |
| 156 | |
| 157 | To immediately analyze specifiic example(s), use the data= parameter: |
| 158 | widget.render(..., data=[{"prompt": "Hello world "}]) |
| 159 | |
| 160 | Args: |
| 161 | height: Optional height to display the LIT UI in pixels. If not specified, |
| 162 | then the height specified in the constructor is used. |
| 163 | open_in_new_tab: Whether to show the UI in a new tab instead of in the |
| 164 | output cell. Defaults to false. |
| 165 | ui_params: Optional configuration options for the LIT UI's state. |
| 166 | data: Optional examples to load directly to the UI (via URL params). |
| 167 | """ |
| 168 | if not height: |
| 169 | height = self._height |
| 170 | if not ui_params: |
| 171 | ui_params = RenderConfig() |
| 172 | if data: |
| 173 | ui_params.datapoints = data |
| 174 | if is_colab: |
| 175 | _display_colab(self._server.port, height, open_in_new_tab, ui_params) |
| 176 | else: |
| 177 | _display_jupyter(self._server.port, height, self._proxy_url, |
| 178 | open_in_new_tab, ui_params) |
| 179 | |
| 180 | |
| 181 | def _display_colab(port, height, open_in_new_tab, ui_params: RenderConfig): |
no test coverage detected