Chenglu-She commited on
Commit
0420d60
·
verified ·
1 Parent(s): 5de8e18

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -137,6 +137,19 @@ bool
137
  <td align="left">if True, will render the component in dark mode.</td>
138
  </tr>
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  <tr>
141
  <td align="left"><code>xterm_allow_proposed_api</code></td>
142
  <td align="left" style="width: 25%;">
 
137
  <td align="left">if True, will render the component in dark mode.</td>
138
  </tr>
139
 
140
+ <tr>
141
+ <td align="left"><code>height</code></td>
142
+ <td align="left" style="width: 25%;">
143
+
144
+ ```python
145
+ str | int | None
146
+ ```
147
+
148
+ </td>
149
+ <td align="left"><code>240</code></td>
150
+ <td align="left">None</td>
151
+ </tr>
152
+
153
  <tr>
154
  <td align="left"><code>xterm_allow_proposed_api</code></td>
155
  <td align="left" style="width: 25%;">
space.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  from app import demo as app
4
  import os
5
 
6
- _docs = {'Log': {'description': 'Create a log component which can continuously read from a log file and display the content in a container.', 'members': {'__init__': {'log_file': {'type': 'str', 'default': 'None', 'description': 'the log file path to read from.'}, 'tail': {'type': 'int', 'default': '100', 'description': 'from the end of the file, the number of lines to start read from.'}, 'dark': {'type': 'bool', 'default': 'False', 'description': 'if True, will render the component in dark mode.'}, 'xterm_allow_proposed_api': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_allow_transparency': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_alt_click_moves_cursor': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_convert_eol': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_cursor_blink': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_cursor_inactive_style': {'type': '"outline" | "block" | "bar" | "underline" | "none"', 'default': '"outline"', 'description': None}, 'xterm_cursor_style': {'type': '"block" | "underline" | "bar"', 'default': '"block"', 'description': None}, 'xterm_cursor_width': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_custom_glyphs': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_disable_stdin': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_document_override': {'type': 'typing.Optional[typing.Any][typing.Any, None]', 'default': 'None', 'description': None}, 'xterm_draw_bold_text_in_bright_colors': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_fast_scroll_modifier': {'type': 'typing.Optional[\n typing.Literal["none", "alt", "ctrl", "shift"]\n]["none" | "alt" | "ctrl" | "shift", None]', 'default': '"alt"', 'description': None}, 'xterm_fast_scroll_sensitivity': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_font_family': {'type': 'typing.Optional[str][str, None]', 'default': '"courier-new, courier, monospace"', 'description': None}, 'xterm_font_size': {'type': 'typing.Optional[int][int, None]', 'default': '15', 'description': None}, 'xterm_font_weight': {'type': 'typing.Optional[\n typing.Literal[\n "normal",\n "bold",\n "100",\n "200",\n "300",\n "400",\n "500",\n "600",\n "700",\n "800",\n "900",\n ]\n][\n "normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900",\n None,\n]', 'default': '"normal"', 'description': None}, 'xterm_font_weight_bold': {'type': 'typing.Optional[\n typing.Literal[\n "normal",\n "bold",\n "100",\n "200",\n "300",\n "400",\n "500",\n "600",\n "700",\n "800",\n "900",\n ]\n][\n "normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900",\n None,\n]', 'default': '"bold"', 'description': None}, 'xterm_ignore_bracketed_paste_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_letter_spacing': {'type': 'typing.Optional[float][float, None]', 'default': '0', 'description': None}, 'xterm_line_height': {'type': 'typing.Optional[float][float, None]', 'default': '1.0', 'description': None}, 'xterm_log_level': {'type': 'typing.Optional[\n typing.Literal[\n "trace", "debug", "info", "warn", "error", "off"\n ]\n][\n "trace" | "debug" | "info" | "warn" | "error" | "off",\n None,\n]', 'default': '"info"', 'description': None}, 'xterm_mac_option_click_forces_selection': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_mac_option_is_meta': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_minimum_contrast_ratio': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_overview_ruler_width': {'type': 'typing.Optional[int][int, None]', 'default': '0', 'description': None}, 'xterm_rescale_overlapping_glyphs': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_screen_reader_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_scroll_on_user_input': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_scroll_sensitivity': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_scrollback': {'type': 'typing.Optional[int][int, None]', 'default': '1000', 'description': None}, 'xterm_smooth_scroll_duration': {'type': 'typing.Optional[int][int, None]', 'default': '0', 'description': None}, 'xterm_tab_stop_width': {'type': 'typing.Optional[int][int, None]', 'default': '8', 'description': None}, 'xterm_windows_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.'}, 'info': {'type': 'str | None', 'default': 'None', 'description': 'additional component description.'}, 'every': {'type': 'float', 'default': '0.3', 'description': 'New log pulling interval.'}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'interactive': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will be rendered as an editable textbox; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}}, 'postprocess': {}, 'preprocess': {'return': {'type': 'typing.Any', 'description': "The preprocessed input data sent to the user's function in the backend."}, 'value': None}}, 'events': {'load': {'type': None, 'default': None, 'description': 'This listener is triggered when the Log initially loads in the browser.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'Log': []}}}
7
 
8
  abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
 
 
3
  from app import demo as app
4
  import os
5
 
6
+ _docs = {'Log': {'description': 'Create a log component which can continuously read from a log file and display the content in a container.', 'members': {'__init__': {'log_file': {'type': 'str', 'default': 'None', 'description': 'the log file path to read from.'}, 'tail': {'type': 'int', 'default': '100', 'description': 'from the end of the file, the number of lines to start read from.'}, 'dark': {'type': 'bool', 'default': 'False', 'description': 'if True, will render the component in dark mode.'}, 'height': {'type': 'str | int | None', 'default': '240', 'description': None}, 'xterm_allow_proposed_api': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_allow_transparency': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_alt_click_moves_cursor': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_convert_eol': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_cursor_blink': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_cursor_inactive_style': {'type': '"outline" | "block" | "bar" | "underline" | "none"', 'default': '"outline"', 'description': None}, 'xterm_cursor_style': {'type': '"block" | "underline" | "bar"', 'default': '"block"', 'description': None}, 'xterm_cursor_width': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_custom_glyphs': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_disable_stdin': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_document_override': {'type': 'typing.Optional[typing.Any][typing.Any, None]', 'default': 'None', 'description': None}, 'xterm_draw_bold_text_in_bright_colors': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_fast_scroll_modifier': {'type': 'typing.Optional[\n typing.Literal["none", "alt", "ctrl", "shift"]\n]["none" | "alt" | "ctrl" | "shift", None]', 'default': '"alt"', 'description': None}, 'xterm_fast_scroll_sensitivity': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_font_family': {'type': 'typing.Optional[str][str, None]', 'default': '"courier-new, courier, monospace"', 'description': None}, 'xterm_font_size': {'type': 'typing.Optional[int][int, None]', 'default': '15', 'description': None}, 'xterm_font_weight': {'type': 'typing.Optional[\n typing.Literal[\n "normal",\n "bold",\n "100",\n "200",\n "300",\n "400",\n "500",\n "600",\n "700",\n "800",\n "900",\n ]\n][\n "normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900",\n None,\n]', 'default': '"normal"', 'description': None}, 'xterm_font_weight_bold': {'type': 'typing.Optional[\n typing.Literal[\n "normal",\n "bold",\n "100",\n "200",\n "300",\n "400",\n "500",\n "600",\n "700",\n "800",\n "900",\n ]\n][\n "normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900",\n None,\n]', 'default': '"bold"', 'description': None}, 'xterm_ignore_bracketed_paste_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_letter_spacing': {'type': 'typing.Optional[float][float, None]', 'default': '0', 'description': None}, 'xterm_line_height': {'type': 'typing.Optional[float][float, None]', 'default': '1.0', 'description': None}, 'xterm_log_level': {'type': 'typing.Optional[\n typing.Literal[\n "trace", "debug", "info", "warn", "error", "off"\n ]\n][\n "trace" | "debug" | "info" | "warn" | "error" | "off",\n None,\n]', 'default': '"info"', 'description': None}, 'xterm_mac_option_click_forces_selection': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_mac_option_is_meta': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_minimum_contrast_ratio': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_overview_ruler_width': {'type': 'typing.Optional[int][int, None]', 'default': '0', 'description': None}, 'xterm_rescale_overlapping_glyphs': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_screen_reader_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_scroll_on_user_input': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_scroll_sensitivity': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_scrollback': {'type': 'typing.Optional[int][int, None]', 'default': '1000', 'description': None}, 'xterm_smooth_scroll_duration': {'type': 'typing.Optional[int][int, None]', 'default': '0', 'description': None}, 'xterm_tab_stop_width': {'type': 'typing.Optional[int][int, None]', 'default': '8', 'description': None}, 'xterm_windows_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.'}, 'info': {'type': 'str | None', 'default': 'None', 'description': 'additional component description.'}, 'every': {'type': 'float', 'default': '0.3', 'description': 'New log pulling interval.'}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'interactive': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will be rendered as an editable textbox; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}}, 'postprocess': {}, 'preprocess': {'return': {'type': 'typing.Any', 'description': "The preprocessed input data sent to the user's function in the backend."}, 'value': None}}, 'events': {'load': {'type': None, 'default': None, 'description': 'This listener is triggered when the Log initially loads in the browser.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'Log': []}}}
7
 
8
  abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
 
src/README.md CHANGED
@@ -137,6 +137,19 @@ bool
137
  <td align="left">if True, will render the component in dark mode.</td>
138
  </tr>
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  <tr>
141
  <td align="left"><code>xterm_allow_proposed_api</code></td>
142
  <td align="left" style="width: 25%;">
 
137
  <td align="left">if True, will render the component in dark mode.</td>
138
  </tr>
139
 
140
+ <tr>
141
+ <td align="left"><code>height</code></td>
142
+ <td align="left" style="width: 25%;">
143
+
144
+ ```python
145
+ str | int | None
146
+ ```
147
+
148
+ </td>
149
+ <td align="left"><code>240</code></td>
150
+ <td align="left">None</td>
151
+ </tr>
152
+
153
  <tr>
154
  <td align="left"><code>xterm_allow_proposed_api</code></td>
155
  <td align="left" style="width: 25%;">
src/backend/gradio_log/log.py CHANGED
@@ -69,6 +69,7 @@ class Log(FormComponent):
69
  log_file: str = None,
70
  tail: int = 100,
71
  dark: bool = False,
 
72
  xterm_allow_proposed_api: Optional[bool] = False,
73
  xterm_allow_transparency: Optional[bool] = False,
74
  xterm_alt_click_moves_cursor: Optional[bool] = True,
@@ -148,6 +149,7 @@ class Log(FormComponent):
148
  self.current_pos = None
149
  self.fd = None
150
  self.stop_reading = False
 
151
 
152
  self.xterm_allow_proposed_api = xterm_allow_proposed_api
153
  self.xterm_allow_transparency = xterm_allow_transparency
 
69
  log_file: str = None,
70
  tail: int = 100,
71
  dark: bool = False,
72
+ height: str | int | None = 240,
73
  xterm_allow_proposed_api: Optional[bool] = False,
74
  xterm_allow_transparency: Optional[bool] = False,
75
  xterm_alt_click_moves_cursor: Optional[bool] = True,
 
149
  self.current_pos = None
150
  self.fd = None
151
  self.stop_reading = False
152
+ self.height = height
153
 
154
  self.xterm_allow_proposed_api = xterm_allow_proposed_api
155
  self.xterm_allow_transparency = xterm_allow_transparency
src/backend/gradio_log/templates/component/index.js CHANGED
The diff for this file is too large to render. See raw diff
 
src/demo/space.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  from app import demo as app
4
  import os
5
 
6
- _docs = {'Log': {'description': 'Create a log component which can continuously read from a log file and display the content in a container.', 'members': {'__init__': {'log_file': {'type': 'str', 'default': 'None', 'description': 'the log file path to read from.'}, 'tail': {'type': 'int', 'default': '100', 'description': 'from the end of the file, the number of lines to start read from.'}, 'dark': {'type': 'bool', 'default': 'False', 'description': 'if True, will render the component in dark mode.'}, 'xterm_allow_proposed_api': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_allow_transparency': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_alt_click_moves_cursor': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_convert_eol': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_cursor_blink': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_cursor_inactive_style': {'type': '"outline" | "block" | "bar" | "underline" | "none"', 'default': '"outline"', 'description': None}, 'xterm_cursor_style': {'type': '"block" | "underline" | "bar"', 'default': '"block"', 'description': None}, 'xterm_cursor_width': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_custom_glyphs': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_disable_stdin': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_document_override': {'type': 'typing.Optional[typing.Any][typing.Any, None]', 'default': 'None', 'description': None}, 'xterm_draw_bold_text_in_bright_colors': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_fast_scroll_modifier': {'type': 'typing.Optional[\n typing.Literal["none", "alt", "ctrl", "shift"]\n]["none" | "alt" | "ctrl" | "shift", None]', 'default': '"alt"', 'description': None}, 'xterm_fast_scroll_sensitivity': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_font_family': {'type': 'typing.Optional[str][str, None]', 'default': '"courier-new, courier, monospace"', 'description': None}, 'xterm_font_size': {'type': 'typing.Optional[int][int, None]', 'default': '15', 'description': None}, 'xterm_font_weight': {'type': 'typing.Optional[\n typing.Literal[\n "normal",\n "bold",\n "100",\n "200",\n "300",\n "400",\n "500",\n "600",\n "700",\n "800",\n "900",\n ]\n][\n "normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900",\n None,\n]', 'default': '"normal"', 'description': None}, 'xterm_font_weight_bold': {'type': 'typing.Optional[\n typing.Literal[\n "normal",\n "bold",\n "100",\n "200",\n "300",\n "400",\n "500",\n "600",\n "700",\n "800",\n "900",\n ]\n][\n "normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900",\n None,\n]', 'default': '"bold"', 'description': None}, 'xterm_ignore_bracketed_paste_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_letter_spacing': {'type': 'typing.Optional[float][float, None]', 'default': '0', 'description': None}, 'xterm_line_height': {'type': 'typing.Optional[float][float, None]', 'default': '1.0', 'description': None}, 'xterm_log_level': {'type': 'typing.Optional[\n typing.Literal[\n "trace", "debug", "info", "warn", "error", "off"\n ]\n][\n "trace" | "debug" | "info" | "warn" | "error" | "off",\n None,\n]', 'default': '"info"', 'description': None}, 'xterm_mac_option_click_forces_selection': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_mac_option_is_meta': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_minimum_contrast_ratio': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_overview_ruler_width': {'type': 'typing.Optional[int][int, None]', 'default': '0', 'description': None}, 'xterm_rescale_overlapping_glyphs': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_screen_reader_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_scroll_on_user_input': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_scroll_sensitivity': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_scrollback': {'type': 'typing.Optional[int][int, None]', 'default': '1000', 'description': None}, 'xterm_smooth_scroll_duration': {'type': 'typing.Optional[int][int, None]', 'default': '0', 'description': None}, 'xterm_tab_stop_width': {'type': 'typing.Optional[int][int, None]', 'default': '8', 'description': None}, 'xterm_windows_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.'}, 'info': {'type': 'str | None', 'default': 'None', 'description': 'additional component description.'}, 'every': {'type': 'float', 'default': '0.3', 'description': 'New log pulling interval.'}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'interactive': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will be rendered as an editable textbox; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}}, 'postprocess': {}, 'preprocess': {'return': {'type': 'typing.Any', 'description': "The preprocessed input data sent to the user's function in the backend."}, 'value': None}}, 'events': {'load': {'type': None, 'default': None, 'description': 'This listener is triggered when the Log initially loads in the browser.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'Log': []}}}
7
 
8
  abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
 
 
3
  from app import demo as app
4
  import os
5
 
6
+ _docs = {'Log': {'description': 'Create a log component which can continuously read from a log file and display the content in a container.', 'members': {'__init__': {'log_file': {'type': 'str', 'default': 'None', 'description': 'the log file path to read from.'}, 'tail': {'type': 'int', 'default': '100', 'description': 'from the end of the file, the number of lines to start read from.'}, 'dark': {'type': 'bool', 'default': 'False', 'description': 'if True, will render the component in dark mode.'}, 'height': {'type': 'str | int | None', 'default': '240', 'description': None}, 'xterm_allow_proposed_api': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_allow_transparency': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_alt_click_moves_cursor': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_convert_eol': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_cursor_blink': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_cursor_inactive_style': {'type': '"outline" | "block" | "bar" | "underline" | "none"', 'default': '"outline"', 'description': None}, 'xterm_cursor_style': {'type': '"block" | "underline" | "bar"', 'default': '"block"', 'description': None}, 'xterm_cursor_width': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_custom_glyphs': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_disable_stdin': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_document_override': {'type': 'typing.Optional[typing.Any][typing.Any, None]', 'default': 'None', 'description': None}, 'xterm_draw_bold_text_in_bright_colors': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_fast_scroll_modifier': {'type': 'typing.Optional[\n typing.Literal["none", "alt", "ctrl", "shift"]\n]["none" | "alt" | "ctrl" | "shift", None]', 'default': '"alt"', 'description': None}, 'xterm_fast_scroll_sensitivity': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_font_family': {'type': 'typing.Optional[str][str, None]', 'default': '"courier-new, courier, monospace"', 'description': None}, 'xterm_font_size': {'type': 'typing.Optional[int][int, None]', 'default': '15', 'description': None}, 'xterm_font_weight': {'type': 'typing.Optional[\n typing.Literal[\n "normal",\n "bold",\n "100",\n "200",\n "300",\n "400",\n "500",\n "600",\n "700",\n "800",\n "900",\n ]\n][\n "normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900",\n None,\n]', 'default': '"normal"', 'description': None}, 'xterm_font_weight_bold': {'type': 'typing.Optional[\n typing.Literal[\n "normal",\n "bold",\n "100",\n "200",\n "300",\n "400",\n "500",\n "600",\n "700",\n "800",\n "900",\n ]\n][\n "normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900",\n None,\n]', 'default': '"bold"', 'description': None}, 'xterm_ignore_bracketed_paste_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_letter_spacing': {'type': 'typing.Optional[float][float, None]', 'default': '0', 'description': None}, 'xterm_line_height': {'type': 'typing.Optional[float][float, None]', 'default': '1.0', 'description': None}, 'xterm_log_level': {'type': 'typing.Optional[\n typing.Literal[\n "trace", "debug", "info", "warn", "error", "off"\n ]\n][\n "trace" | "debug" | "info" | "warn" | "error" | "off",\n None,\n]', 'default': '"info"', 'description': None}, 'xterm_mac_option_click_forces_selection': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_mac_option_is_meta': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_minimum_contrast_ratio': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_overview_ruler_width': {'type': 'typing.Optional[int][int, None]', 'default': '0', 'description': None}, 'xterm_rescale_overlapping_glyphs': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_screen_reader_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'xterm_scroll_on_user_input': {'type': 'typing.Optional[bool][bool, None]', 'default': 'True', 'description': None}, 'xterm_scroll_sensitivity': {'type': 'typing.Optional[int][int, None]', 'default': '1', 'description': None}, 'xterm_scrollback': {'type': 'typing.Optional[int][int, None]', 'default': '1000', 'description': None}, 'xterm_smooth_scroll_duration': {'type': 'typing.Optional[int][int, None]', 'default': '0', 'description': None}, 'xterm_tab_stop_width': {'type': 'typing.Optional[int][int, None]', 'default': '8', 'description': None}, 'xterm_windows_mode': {'type': 'typing.Optional[bool][bool, None]', 'default': 'False', 'description': None}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.'}, 'info': {'type': 'str | None', 'default': 'None', 'description': 'additional component description.'}, 'every': {'type': 'float', 'default': '0.3', 'description': 'New log pulling interval.'}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'interactive': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will be rendered as an editable textbox; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}}, 'postprocess': {}, 'preprocess': {'return': {'type': 'typing.Any', 'description': "The preprocessed input data sent to the user's function in the backend."}, 'value': None}}, 'events': {'load': {'type': None, 'default': None, 'description': 'This listener is triggered when the Log initially loads in the browser.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'Log': []}}}
7
 
8
  abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
 
src/frontend/Index.svelte CHANGED
@@ -15,6 +15,7 @@
15
  submit: never;
16
  input: never;
17
  }>;
 
18
  export let log_file = "";
19
  export let label = `log of ${log_file}`;
20
  export let dark = false;
@@ -112,19 +113,20 @@
112
  scrollback: xterm_scrollback,
113
  windowsMode: xterm_windows_mode,
114
  });
 
115
  term.open(termNode);
116
  const fitAddon = new FitAddon();
117
  term.loadAddon(fitAddon);
118
- setTimeout(() => {
119
- fitAddon.fit();
120
- }, 300);
121
 
122
  const handleWindowResize = () => {
123
  fitAddon.fit();
124
  };
125
 
126
- window.addEventListener("resize", handleWindowResize);
 
 
127
 
 
128
  return () => {
129
  window.removeEventListener("resize", handleWindowResize);
130
  };
@@ -142,6 +144,7 @@
142
  {elem_id}
143
  {scale}
144
  {min_width}
 
145
  elem_classes={[...elem_classes, dark ? "dark" : ""]}
146
  allow_overflow={false}
147
  padding={true}
@@ -153,9 +156,9 @@
153
  {...loading_status}
154
  />
155
  {/if}
156
- <div>
157
  <BlockTitle {show_label} info={undefined}>{label}</BlockTitle>
158
- <div bind:this={termNode}></div>
159
  </div>
160
  </Block>
161
 
 
15
  submit: never;
16
  input: never;
17
  }>;
18
+ export let height = 240;
19
  export let log_file = "";
20
  export let label = `log of ${log_file}`;
21
  export let dark = false;
 
113
  scrollback: xterm_scrollback,
114
  windowsMode: xterm_windows_mode,
115
  });
116
+
117
  term.open(termNode);
118
  const fitAddon = new FitAddon();
119
  term.loadAddon(fitAddon);
 
 
 
120
 
121
  const handleWindowResize = () => {
122
  fitAddon.fit();
123
  };
124
 
125
+ setTimeout(() => {
126
+ fitAddon.fit();
127
+ }, 300);
128
 
129
+ window.addEventListener("resize", handleWindowResize);
130
  return () => {
131
  window.removeEventListener("resize", handleWindowResize);
132
  };
 
144
  {elem_id}
145
  {scale}
146
  {min_width}
147
+ {height}
148
  elem_classes={[...elem_classes, dark ? "dark" : ""]}
149
  allow_overflow={false}
150
  padding={true}
 
156
  {...loading_status}
157
  />
158
  {/if}
159
+ <div style="height: 100%;">
160
  <BlockTitle {show_label} info={undefined}>{label}</BlockTitle>
161
+ <div style="height: calc(100% - 10px);" bind:this={termNode}></div>
162
  </div>
163
  </Block>
164
 
src/pyproject.toml CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
8
 
9
  [project]
10
  name = "gradio_log"
11
- version = "0.0.5"
12
  description = "A Log component for Gradio which can easily show some log file in the interface."
13
  readme = "README.md"
14
  license = "Apache-2.0"
 
8
 
9
  [project]
10
  name = "gradio_log"
11
+ version = "0.0.6"
12
  description = "A Log component for Gradio which can easily show some log file in the interface."
13
  readme = "README.md"
14
  license = "Apache-2.0"