Spaces:
Configuration error
Configuration error
Chenglu-She
commited on
Commit
•
59a8d69
1
Parent(s):
0420d60
Upload folder using huggingface_hub
Browse files- README.md +1 -1
- space.py +1 -1
- src/README.md +1 -1
- src/backend/gradio_log/log.py +47 -39
- src/demo/space.py +1 -1
- src/pyproject.toml +1 -1
README.md
CHANGED
@@ -690,7 +690,7 @@ float
|
|
690 |
```
|
691 |
|
692 |
</td>
|
693 |
-
<td align="left"><code>0.
|
694 |
<td align="left">New log pulling interval.</td>
|
695 |
</tr>
|
696 |
|
|
|
690 |
```
|
691 |
|
692 |
</td>
|
693 |
+
<td align="left"><code>0.5</code></td>
|
694 |
<td align="left">New log pulling interval.</td>
|
695 |
</tr>
|
696 |
|
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.'}, '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.
|
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.5', '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
@@ -690,7 +690,7 @@ float
|
|
690 |
```
|
691 |
|
692 |
</td>
|
693 |
-
<td align="left"><code>0.
|
694 |
<td align="left">New log pulling interval.</td>
|
695 |
</tr>
|
696 |
|
|
|
690 |
```
|
691 |
|
692 |
</td>
|
693 |
+
<td align="left"><code>0.5</code></td>
|
694 |
<td align="left">New log pulling interval.</td>
|
695 |
</tr>
|
696 |
|
src/backend/gradio_log/log.py
CHANGED
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
5 |
import time
|
6 |
from typing import Any, Literal, Optional
|
7 |
|
|
|
8 |
from gradio.components.base import FormComponent
|
9 |
from gradio.events import Events
|
10 |
from gradio_client.documentation import document
|
@@ -35,34 +36,41 @@ class Log(FormComponent):
|
|
35 |
EVENTS = [Events.load]
|
36 |
|
37 |
def find_start_position(self) -> int:
|
38 |
-
self.
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
self.
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
def __init__(
|
68 |
self,
|
@@ -111,7 +119,7 @@ class Log(FormComponent):
|
|
111 |
*,
|
112 |
label: str | None = None,
|
113 |
info: str | None = None,
|
114 |
-
every: float = 0.
|
115 |
show_label: bool | None = None,
|
116 |
container: bool = True,
|
117 |
scale: int | None = None,
|
@@ -147,9 +155,8 @@ class Log(FormComponent):
|
|
147 |
self.tail = tail
|
148 |
self.dark = dark
|
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
|
@@ -190,6 +197,8 @@ class Log(FormComponent):
|
|
190 |
self.xterm_tab_stop_width = xterm_tab_stop_width
|
191 |
self.xterm_windows_mode = xterm_windows_mode
|
192 |
|
|
|
|
|
193 |
super().__init__(
|
194 |
label=label,
|
195 |
info=info,
|
@@ -203,18 +212,17 @@ class Log(FormComponent):
|
|
203 |
elem_id=elem_id,
|
204 |
elem_classes=elem_classes,
|
205 |
render=render,
|
|
|
206 |
value=self.read_to_end,
|
207 |
)
|
208 |
|
209 |
-
self.load(self.handle_load_event)
|
|
|
|
|
|
|
210 |
|
211 |
-
def
|
212 |
-
|
213 |
-
self.stop_reading = True
|
214 |
-
time.sleep(1)
|
215 |
-
self.io = open(self.log_file, "rb")
|
216 |
-
self.current_pos = self.find_start_position()
|
217 |
-
self.stop_reading = False
|
218 |
|
219 |
def api_info(self) -> dict[str, Any]:
|
220 |
return {"type": "string"}
|
|
|
5 |
import time
|
6 |
from typing import Any, Literal, Optional
|
7 |
|
8 |
+
import gradio as gr
|
9 |
from gradio.components.base import FormComponent
|
10 |
from gradio.events import Events
|
11 |
from gradio_client.documentation import document
|
|
|
36 |
EVENTS = [Events.load]
|
37 |
|
38 |
def find_start_position(self) -> int:
|
39 |
+
with open(self.log_file, "rb") as f:
|
40 |
+
f.seek(0, 2)
|
41 |
+
|
42 |
+
file_size = f.tell()
|
43 |
+
lines_found = 0
|
44 |
+
block_size = 1024
|
45 |
+
blocks = []
|
46 |
+
|
47 |
+
while f.tell() > 0 and lines_found <= self.tail:
|
48 |
+
f.seek(max(f.tell() - block_size, 0))
|
49 |
+
block = f.read(block_size)
|
50 |
+
blocks.append(block)
|
51 |
+
lines_found += block.count(b"\n")
|
52 |
+
f.seek(-len(block), 1)
|
53 |
+
|
54 |
+
all_read_bytes = b"".join(reversed(blocks))
|
55 |
+
lines = all_read_bytes.splitlines()
|
56 |
+
|
57 |
+
if self.tail >= len(lines):
|
58 |
+
return 0
|
59 |
+
last_lines = b"\n".join(lines[-self.tail :])
|
60 |
+
return file_size - len(last_lines) - 1
|
61 |
+
|
62 |
+
def get_current_reading_pos(self, session_hash: str) -> int:
|
63 |
+
if session_hash not in self.current_reading_positions:
|
64 |
+
self.current_reading_positions[session_hash] = self.find_start_position()
|
65 |
+
return self.current_reading_positions[session_hash]
|
66 |
+
|
67 |
+
def read_to_end(self, session_hash: str) -> bytes:
|
68 |
+
with open(self.log_file, "rb") as f:
|
69 |
+
current_pos = self.get_current_reading_pos(session_hash)
|
70 |
+
f.seek(current_pos)
|
71 |
+
b = f.read().decode()
|
72 |
+
current_pos = f.tell()
|
73 |
+
return b
|
74 |
|
75 |
def __init__(
|
76 |
self,
|
|
|
119 |
*,
|
120 |
label: str | None = None,
|
121 |
info: str | None = None,
|
122 |
+
every: float = 0.5,
|
123 |
show_label: bool | None = None,
|
124 |
container: bool = True,
|
125 |
scale: int | None = None,
|
|
|
155 |
self.tail = tail
|
156 |
self.dark = dark
|
157 |
self.current_pos = None
|
|
|
|
|
158 |
self.height = height
|
159 |
+
self.current_reading_positions = {}
|
160 |
|
161 |
self.xterm_allow_proposed_api = xterm_allow_proposed_api
|
162 |
self.xterm_allow_transparency = xterm_allow_transparency
|
|
|
197 |
self.xterm_tab_stop_width = xterm_tab_stop_width
|
198 |
self.xterm_windows_mode = xterm_windows_mode
|
199 |
|
200 |
+
self.state = gr.State(None)
|
201 |
+
|
202 |
super().__init__(
|
203 |
label=label,
|
204 |
info=info,
|
|
|
212 |
elem_id=elem_id,
|
213 |
elem_classes=elem_classes,
|
214 |
render=render,
|
215 |
+
inputs=[self.state],
|
216 |
value=self.read_to_end,
|
217 |
)
|
218 |
|
219 |
+
self.load(self.handle_load_event, outputs=self.state)
|
220 |
+
|
221 |
+
def handle_load_event(self, request: gr.Request) -> str:
|
222 |
+
return request.session_hash
|
223 |
|
224 |
+
def handle_unload_event(self, request: gr.Request):
|
225 |
+
print("request on unload: ", request)
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
def api_info(self) -> dict[str, Any]:
|
228 |
return {"type": "string"}
|
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.'}, '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.
|
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.5', '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/pyproject.toml
CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
|
|
8 |
|
9 |
[project]
|
10 |
name = "gradio_log"
|
11 |
-
version = "0.0.
|
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.7"
|
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"
|