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

Upload folder using huggingface_hub

Browse files
.gitignore ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .eggs/
2
+ dist/
3
+ *.pyc
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+ __tmp/*
8
+ *.pyi
9
+ node_modules
10
+ test.log
11
+ .DS_Store
12
+ backend/gradio_log/templates
13
+ demo/space.py
README.md CHANGED
@@ -1,17 +1,829 @@
1
 
2
- ---
3
- tags: [gradio-custom-component,gradio-template-SimpleTextbox,log,gradio_log,gradio_log_component,gradio_print_log]
4
- title: gradio_log V0.0.4
5
- colorFrom: blue
6
- colorTo: yellow
7
- sdk: docker
8
- pinned: false
9
- license: apache-2.0
10
- ---
11
 
 
12
 
13
- # Name: gradio_log
14
 
15
- Description: A Log component for Gradio which can easily show some log file in the interface.
 
 
16
 
17
- Install with: pip install gradio_log
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
+ # `gradio_log`
3
+ <a href="https://pypi.org/project/gradio_log/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_log"></a>
 
 
 
 
 
 
 
4
 
5
+ A Log component for Gradio which can easily show some log file in the interface.
6
 
7
+ ## Installation
8
 
9
+ ```bash
10
+ pip install gradio_log
11
+ ```
12
 
13
+ ## Usage
14
+
15
+ ```python
16
+ import logging
17
+ from pathlib import Path
18
+
19
+ import gradio as gr
20
+ from gradio_log import Log
21
+
22
+
23
+ class CustomFormatter(logging.Formatter):
24
+
25
+ green = "\x1b[32;20m"
26
+ blue = "\x1b[34;20m"
27
+ yellow = "\x1b[33;20m"
28
+ red = "\x1b[31;20m"
29
+ bold_red = "\x1b[31;1m"
30
+ reset = "\x1b[0m"
31
+ format = "%(asctime)s - %(levelname)s - %(message)s (%(filename)s:%(lineno)d)"
32
+
33
+ FORMATS = {
34
+ logging.DEBUG: blue + format + reset,
35
+ logging.INFO: green + format + reset,
36
+ logging.WARNING: yellow + format + reset,
37
+ logging.ERROR: red + format + reset,
38
+ logging.CRITICAL: bold_red + format + reset,
39
+ }
40
+
41
+ def format(self, record):
42
+ log_fmt = self.FORMATS.get(record.levelno)
43
+ formatter = logging.Formatter(log_fmt)
44
+ return formatter.format(record)
45
+
46
+
47
+ formatter = CustomFormatter()
48
+
49
+ log_file = "/tmp/gradio_log.txt"
50
+ Path(log_file).touch()
51
+
52
+ ch = logging.FileHandler(log_file)
53
+ ch.setLevel(logging.DEBUG)
54
+ ch.setFormatter(formatter)
55
+
56
+ logger = logging.getLogger("gradio_log")
57
+ logger.setLevel(logging.DEBUG)
58
+ for handler in logger.handlers:
59
+ logger.removeHandler(handler)
60
+ logger.addHandler(ch)
61
+
62
+
63
+ logger.info("The logs will be displayed in here.")
64
+
65
+
66
+ def create_log_handler(level):
67
+ def l(text):
68
+ getattr(logger, level)(text)
69
+
70
+ return l
71
+
72
+
73
+ with gr.Blocks() as demo:
74
+ text = gr.Textbox(label="Enter text to write to log file")
75
+ with gr.Row():
76
+ for l in ["debug", "info", "warning", "error", "critical"]:
77
+ button = gr.Button(f"log as {l}")
78
+ button.click(fn=create_log_handler(l), inputs=text)
79
+ Log(log_file, dark=True)
80
+
81
+
82
+ if __name__ == "__main__":
83
+ demo.launch(ssr_mode=True)
84
+
85
+ ```
86
+
87
+ ## `Log`
88
+
89
+ ### Initialization
90
+
91
+ <table>
92
+ <thead>
93
+ <tr>
94
+ <th align="left">name</th>
95
+ <th align="left" style="width: 25%;">type</th>
96
+ <th align="left">default</th>
97
+ <th align="left">description</th>
98
+ </tr>
99
+ </thead>
100
+ <tbody>
101
+ <tr>
102
+ <td align="left"><code>log_file</code></td>
103
+ <td align="left" style="width: 25%;">
104
+
105
+ ```python
106
+ str
107
+ ```
108
+
109
+ </td>
110
+ <td align="left"><code>None</code></td>
111
+ <td align="left">the log file path to read from.</td>
112
+ </tr>
113
+
114
+ <tr>
115
+ <td align="left"><code>tail</code></td>
116
+ <td align="left" style="width: 25%;">
117
+
118
+ ```python
119
+ int
120
+ ```
121
+
122
+ </td>
123
+ <td align="left"><code>100</code></td>
124
+ <td align="left">from the end of the file, the number of lines to start read from.</td>
125
+ </tr>
126
+
127
+ <tr>
128
+ <td align="left"><code>dark</code></td>
129
+ <td align="left" style="width: 25%;">
130
+
131
+ ```python
132
+ bool
133
+ ```
134
+
135
+ </td>
136
+ <td align="left"><code>False</code></td>
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%;">
143
+
144
+ ```python
145
+ typing.Optional[bool][bool, None]
146
+ ```
147
+
148
+ </td>
149
+ <td align="left"><code>False</code></td>
150
+ <td align="left">None</td>
151
+ </tr>
152
+
153
+ <tr>
154
+ <td align="left"><code>xterm_allow_transparency</code></td>
155
+ <td align="left" style="width: 25%;">
156
+
157
+ ```python
158
+ typing.Optional[bool][bool, None]
159
+ ```
160
+
161
+ </td>
162
+ <td align="left"><code>False</code></td>
163
+ <td align="left">None</td>
164
+ </tr>
165
+
166
+ <tr>
167
+ <td align="left"><code>xterm_alt_click_moves_cursor</code></td>
168
+ <td align="left" style="width: 25%;">
169
+
170
+ ```python
171
+ typing.Optional[bool][bool, None]
172
+ ```
173
+
174
+ </td>
175
+ <td align="left"><code>True</code></td>
176
+ <td align="left">None</td>
177
+ </tr>
178
+
179
+ <tr>
180
+ <td align="left"><code>xterm_convert_eol</code></td>
181
+ <td align="left" style="width: 25%;">
182
+
183
+ ```python
184
+ typing.Optional[bool][bool, None]
185
+ ```
186
+
187
+ </td>
188
+ <td align="left"><code>False</code></td>
189
+ <td align="left">None</td>
190
+ </tr>
191
+
192
+ <tr>
193
+ <td align="left"><code>xterm_cursor_blink</code></td>
194
+ <td align="left" style="width: 25%;">
195
+
196
+ ```python
197
+ typing.Optional[bool][bool, None]
198
+ ```
199
+
200
+ </td>
201
+ <td align="left"><code>False</code></td>
202
+ <td align="left">None</td>
203
+ </tr>
204
+
205
+ <tr>
206
+ <td align="left"><code>xterm_cursor_inactive_style</code></td>
207
+ <td align="left" style="width: 25%;">
208
+
209
+ ```python
210
+ "outline" | "block" | "bar" | "underline" | "none"
211
+ ```
212
+
213
+ </td>
214
+ <td align="left"><code>"outline"</code></td>
215
+ <td align="left">None</td>
216
+ </tr>
217
+
218
+ <tr>
219
+ <td align="left"><code>xterm_cursor_style</code></td>
220
+ <td align="left" style="width: 25%;">
221
+
222
+ ```python
223
+ "block" | "underline" | "bar"
224
+ ```
225
+
226
+ </td>
227
+ <td align="left"><code>"block"</code></td>
228
+ <td align="left">None</td>
229
+ </tr>
230
+
231
+ <tr>
232
+ <td align="left"><code>xterm_cursor_width</code></td>
233
+ <td align="left" style="width: 25%;">
234
+
235
+ ```python
236
+ typing.Optional[int][int, None]
237
+ ```
238
+
239
+ </td>
240
+ <td align="left"><code>1</code></td>
241
+ <td align="left">None</td>
242
+ </tr>
243
+
244
+ <tr>
245
+ <td align="left"><code>xterm_custom_glyphs</code></td>
246
+ <td align="left" style="width: 25%;">
247
+
248
+ ```python
249
+ typing.Optional[bool][bool, None]
250
+ ```
251
+
252
+ </td>
253
+ <td align="left"><code>False</code></td>
254
+ <td align="left">None</td>
255
+ </tr>
256
+
257
+ <tr>
258
+ <td align="left"><code>xterm_disable_stdin</code></td>
259
+ <td align="left" style="width: 25%;">
260
+
261
+ ```python
262
+ typing.Optional[bool][bool, None]
263
+ ```
264
+
265
+ </td>
266
+ <td align="left"><code>True</code></td>
267
+ <td align="left">None</td>
268
+ </tr>
269
+
270
+ <tr>
271
+ <td align="left"><code>xterm_document_override</code></td>
272
+ <td align="left" style="width: 25%;">
273
+
274
+ ```python
275
+ typing.Optional[typing.Any][typing.Any, None]
276
+ ```
277
+
278
+ </td>
279
+ <td align="left"><code>None</code></td>
280
+ <td align="left">None</td>
281
+ </tr>
282
+
283
+ <tr>
284
+ <td align="left"><code>xterm_draw_bold_text_in_bright_colors</code></td>
285
+ <td align="left" style="width: 25%;">
286
+
287
+ ```python
288
+ typing.Optional[bool][bool, None]
289
+ ```
290
+
291
+ </td>
292
+ <td align="left"><code>True</code></td>
293
+ <td align="left">None</td>
294
+ </tr>
295
+
296
+ <tr>
297
+ <td align="left"><code>xterm_fast_scroll_modifier</code></td>
298
+ <td align="left" style="width: 25%;">
299
+
300
+ ```python
301
+ typing.Optional[
302
+ typing.Literal["none", "alt", "ctrl", "shift"]
303
+ ]["none" | "alt" | "ctrl" | "shift", None]
304
+ ```
305
+
306
+ </td>
307
+ <td align="left"><code>"alt"</code></td>
308
+ <td align="left">None</td>
309
+ </tr>
310
+
311
+ <tr>
312
+ <td align="left"><code>xterm_fast_scroll_sensitivity</code></td>
313
+ <td align="left" style="width: 25%;">
314
+
315
+ ```python
316
+ typing.Optional[int][int, None]
317
+ ```
318
+
319
+ </td>
320
+ <td align="left"><code>1</code></td>
321
+ <td align="left">None</td>
322
+ </tr>
323
+
324
+ <tr>
325
+ <td align="left"><code>xterm_font_family</code></td>
326
+ <td align="left" style="width: 25%;">
327
+
328
+ ```python
329
+ typing.Optional[str][str, None]
330
+ ```
331
+
332
+ </td>
333
+ <td align="left"><code>"courier-new, courier, monospace"</code></td>
334
+ <td align="left">None</td>
335
+ </tr>
336
+
337
+ <tr>
338
+ <td align="left"><code>xterm_font_size</code></td>
339
+ <td align="left" style="width: 25%;">
340
+
341
+ ```python
342
+ typing.Optional[int][int, None]
343
+ ```
344
+
345
+ </td>
346
+ <td align="left"><code>15</code></td>
347
+ <td align="left">None</td>
348
+ </tr>
349
+
350
+ <tr>
351
+ <td align="left"><code>xterm_font_weight</code></td>
352
+ <td align="left" style="width: 25%;">
353
+
354
+ ```python
355
+ typing.Optional[
356
+ typing.Literal[
357
+ "normal",
358
+ "bold",
359
+ "100",
360
+ "200",
361
+ "300",
362
+ "400",
363
+ "500",
364
+ "600",
365
+ "700",
366
+ "800",
367
+ "900",
368
+ ]
369
+ ][
370
+ "normal"
371
+ | "bold"
372
+ | "100"
373
+ | "200"
374
+ | "300"
375
+ | "400"
376
+ | "500"
377
+ | "600"
378
+ | "700"
379
+ | "800"
380
+ | "900",
381
+ None,
382
+ ]
383
+ ```
384
+
385
+ </td>
386
+ <td align="left"><code>"normal"</code></td>
387
+ <td align="left">None</td>
388
+ </tr>
389
+
390
+ <tr>
391
+ <td align="left"><code>xterm_font_weight_bold</code></td>
392
+ <td align="left" style="width: 25%;">
393
+
394
+ ```python
395
+ typing.Optional[
396
+ typing.Literal[
397
+ "normal",
398
+ "bold",
399
+ "100",
400
+ "200",
401
+ "300",
402
+ "400",
403
+ "500",
404
+ "600",
405
+ "700",
406
+ "800",
407
+ "900",
408
+ ]
409
+ ][
410
+ "normal"
411
+ | "bold"
412
+ | "100"
413
+ | "200"
414
+ | "300"
415
+ | "400"
416
+ | "500"
417
+ | "600"
418
+ | "700"
419
+ | "800"
420
+ | "900",
421
+ None,
422
+ ]
423
+ ```
424
+
425
+ </td>
426
+ <td align="left"><code>"bold"</code></td>
427
+ <td align="left">None</td>
428
+ </tr>
429
+
430
+ <tr>
431
+ <td align="left"><code>xterm_ignore_bracketed_paste_mode</code></td>
432
+ <td align="left" style="width: 25%;">
433
+
434
+ ```python
435
+ typing.Optional[bool][bool, None]
436
+ ```
437
+
438
+ </td>
439
+ <td align="left"><code>False</code></td>
440
+ <td align="left">None</td>
441
+ </tr>
442
+
443
+ <tr>
444
+ <td align="left"><code>xterm_letter_spacing</code></td>
445
+ <td align="left" style="width: 25%;">
446
+
447
+ ```python
448
+ typing.Optional[float][float, None]
449
+ ```
450
+
451
+ </td>
452
+ <td align="left"><code>0</code></td>
453
+ <td align="left">None</td>
454
+ </tr>
455
+
456
+ <tr>
457
+ <td align="left"><code>xterm_line_height</code></td>
458
+ <td align="left" style="width: 25%;">
459
+
460
+ ```python
461
+ typing.Optional[float][float, None]
462
+ ```
463
+
464
+ </td>
465
+ <td align="left"><code>1.0</code></td>
466
+ <td align="left">None</td>
467
+ </tr>
468
+
469
+ <tr>
470
+ <td align="left"><code>xterm_log_level</code></td>
471
+ <td align="left" style="width: 25%;">
472
+
473
+ ```python
474
+ typing.Optional[
475
+ typing.Literal[
476
+ "trace", "debug", "info", "warn", "error", "off"
477
+ ]
478
+ ][
479
+ "trace" | "debug" | "info" | "warn" | "error" | "off",
480
+ None,
481
+ ]
482
+ ```
483
+
484
+ </td>
485
+ <td align="left"><code>"info"</code></td>
486
+ <td align="left">None</td>
487
+ </tr>
488
+
489
+ <tr>
490
+ <td align="left"><code>xterm_mac_option_click_forces_selection</code></td>
491
+ <td align="left" style="width: 25%;">
492
+
493
+ ```python
494
+ typing.Optional[bool][bool, None]
495
+ ```
496
+
497
+ </td>
498
+ <td align="left"><code>False</code></td>
499
+ <td align="left">None</td>
500
+ </tr>
501
+
502
+ <tr>
503
+ <td align="left"><code>xterm_mac_option_is_meta</code></td>
504
+ <td align="left" style="width: 25%;">
505
+
506
+ ```python
507
+ typing.Optional[bool][bool, None]
508
+ ```
509
+
510
+ </td>
511
+ <td align="left"><code>False</code></td>
512
+ <td align="left">None</td>
513
+ </tr>
514
+
515
+ <tr>
516
+ <td align="left"><code>xterm_minimum_contrast_ratio</code></td>
517
+ <td align="left" style="width: 25%;">
518
+
519
+ ```python
520
+ typing.Optional[int][int, None]
521
+ ```
522
+
523
+ </td>
524
+ <td align="left"><code>1</code></td>
525
+ <td align="left">None</td>
526
+ </tr>
527
+
528
+ <tr>
529
+ <td align="left"><code>xterm_overview_ruler_width</code></td>
530
+ <td align="left" style="width: 25%;">
531
+
532
+ ```python
533
+ typing.Optional[int][int, None]
534
+ ```
535
+
536
+ </td>
537
+ <td align="left"><code>0</code></td>
538
+ <td align="left">None</td>
539
+ </tr>
540
+
541
+ <tr>
542
+ <td align="left"><code>xterm_rescale_overlapping_glyphs</code></td>
543
+ <td align="left" style="width: 25%;">
544
+
545
+ ```python
546
+ typing.Optional[bool][bool, None]
547
+ ```
548
+
549
+ </td>
550
+ <td align="left"><code>False</code></td>
551
+ <td align="left">None</td>
552
+ </tr>
553
+
554
+ <tr>
555
+ <td align="left"><code>xterm_screen_reader_mode</code></td>
556
+ <td align="left" style="width: 25%;">
557
+
558
+ ```python
559
+ typing.Optional[bool][bool, None]
560
+ ```
561
+
562
+ </td>
563
+ <td align="left"><code>False</code></td>
564
+ <td align="left">None</td>
565
+ </tr>
566
+
567
+ <tr>
568
+ <td align="left"><code>xterm_scroll_on_user_input</code></td>
569
+ <td align="left" style="width: 25%;">
570
+
571
+ ```python
572
+ typing.Optional[bool][bool, None]
573
+ ```
574
+
575
+ </td>
576
+ <td align="left"><code>True</code></td>
577
+ <td align="left">None</td>
578
+ </tr>
579
+
580
+ <tr>
581
+ <td align="left"><code>xterm_scroll_sensitivity</code></td>
582
+ <td align="left" style="width: 25%;">
583
+
584
+ ```python
585
+ typing.Optional[int][int, None]
586
+ ```
587
+
588
+ </td>
589
+ <td align="left"><code>1</code></td>
590
+ <td align="left">None</td>
591
+ </tr>
592
+
593
+ <tr>
594
+ <td align="left"><code>xterm_scrollback</code></td>
595
+ <td align="left" style="width: 25%;">
596
+
597
+ ```python
598
+ typing.Optional[int][int, None]
599
+ ```
600
+
601
+ </td>
602
+ <td align="left"><code>1000</code></td>
603
+ <td align="left">None</td>
604
+ </tr>
605
+
606
+ <tr>
607
+ <td align="left"><code>xterm_smooth_scroll_duration</code></td>
608
+ <td align="left" style="width: 25%;">
609
+
610
+ ```python
611
+ typing.Optional[int][int, None]
612
+ ```
613
+
614
+ </td>
615
+ <td align="left"><code>0</code></td>
616
+ <td align="left">None</td>
617
+ </tr>
618
+
619
+ <tr>
620
+ <td align="left"><code>xterm_tab_stop_width</code></td>
621
+ <td align="left" style="width: 25%;">
622
+
623
+ ```python
624
+ typing.Optional[int][int, None]
625
+ ```
626
+
627
+ </td>
628
+ <td align="left"><code>8</code></td>
629
+ <td align="left">None</td>
630
+ </tr>
631
+
632
+ <tr>
633
+ <td align="left"><code>xterm_windows_mode</code></td>
634
+ <td align="left" style="width: 25%;">
635
+
636
+ ```python
637
+ typing.Optional[bool][bool, None]
638
+ ```
639
+
640
+ </td>
641
+ <td align="left"><code>False</code></td>
642
+ <td align="left">None</td>
643
+ </tr>
644
+
645
+ <tr>
646
+ <td align="left"><code>label</code></td>
647
+ <td align="left" style="width: 25%;">
648
+
649
+ ```python
650
+ str | None
651
+ ```
652
+
653
+ </td>
654
+ <td align="left"><code>None</code></td>
655
+ <td align="left">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.</td>
656
+ </tr>
657
+
658
+ <tr>
659
+ <td align="left"><code>info</code></td>
660
+ <td align="left" style="width: 25%;">
661
+
662
+ ```python
663
+ str | None
664
+ ```
665
+
666
+ </td>
667
+ <td align="left"><code>None</code></td>
668
+ <td align="left">additional component description.</td>
669
+ </tr>
670
+
671
+ <tr>
672
+ <td align="left"><code>every</code></td>
673
+ <td align="left" style="width: 25%;">
674
+
675
+ ```python
676
+ float
677
+ ```
678
+
679
+ </td>
680
+ <td align="left"><code>0.3</code></td>
681
+ <td align="left">New log pulling interval.</td>
682
+ </tr>
683
+
684
+ <tr>
685
+ <td align="left"><code>show_label</code></td>
686
+ <td align="left" style="width: 25%;">
687
+
688
+ ```python
689
+ bool | None
690
+ ```
691
+
692
+ </td>
693
+ <td align="left"><code>None</code></td>
694
+ <td align="left">if True, will display label.</td>
695
+ </tr>
696
+
697
+ <tr>
698
+ <td align="left"><code>container</code></td>
699
+ <td align="left" style="width: 25%;">
700
+
701
+ ```python
702
+ bool
703
+ ```
704
+
705
+ </td>
706
+ <td align="left"><code>True</code></td>
707
+ <td align="left">If True, will place the component in a container - providing some extra padding around the border.</td>
708
+ </tr>
709
+
710
+ <tr>
711
+ <td align="left"><code>scale</code></td>
712
+ <td align="left" style="width: 25%;">
713
+
714
+ ```python
715
+ int | None
716
+ ```
717
+
718
+ </td>
719
+ <td align="left"><code>None</code></td>
720
+ <td align="left">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.</td>
721
+ </tr>
722
+
723
+ <tr>
724
+ <td align="left"><code>min_width</code></td>
725
+ <td align="left" style="width: 25%;">
726
+
727
+ ```python
728
+ int
729
+ ```
730
+
731
+ </td>
732
+ <td align="left"><code>160</code></td>
733
+ <td align="left">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.</td>
734
+ </tr>
735
+
736
+ <tr>
737
+ <td align="left"><code>interactive</code></td>
738
+ <td align="left" style="width: 25%;">
739
+
740
+ ```python
741
+ bool | None
742
+ ```
743
+
744
+ </td>
745
+ <td align="left"><code>None</code></td>
746
+ <td align="left">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.</td>
747
+ </tr>
748
+
749
+ <tr>
750
+ <td align="left"><code>visible</code></td>
751
+ <td align="left" style="width: 25%;">
752
+
753
+ ```python
754
+ bool
755
+ ```
756
+
757
+ </td>
758
+ <td align="left"><code>True</code></td>
759
+ <td align="left">If False, component will be hidden.</td>
760
+ </tr>
761
+
762
+ <tr>
763
+ <td align="left"><code>elem_id</code></td>
764
+ <td align="left" style="width: 25%;">
765
+
766
+ ```python
767
+ str | None
768
+ ```
769
+
770
+ </td>
771
+ <td align="left"><code>None</code></td>
772
+ <td align="left">An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.</td>
773
+ </tr>
774
+
775
+ <tr>
776
+ <td align="left"><code>elem_classes</code></td>
777
+ <td align="left" style="width: 25%;">
778
+
779
+ ```python
780
+ list[str] | str | None
781
+ ```
782
+
783
+ </td>
784
+ <td align="left"><code>None</code></td>
785
+ <td align="left">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.</td>
786
+ </tr>
787
+
788
+ <tr>
789
+ <td align="left"><code>render</code></td>
790
+ <td align="left" style="width: 25%;">
791
+
792
+ ```python
793
+ bool
794
+ ```
795
+
796
+ </td>
797
+ <td align="left"><code>True</code></td>
798
+ <td align="left">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.</td>
799
+ </tr>
800
+ </tbody></table>
801
+
802
+
803
+ ### Events
804
+
805
+ | name | description |
806
+ |:-----|:------------|
807
+ | `load` | This listener is triggered when the Log initially loads in the browser. |
808
+
809
+
810
+
811
+ ### User function
812
+
813
+ The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
814
+
815
+ - When used as an Input, the component only impacts the input signature of the user function.
816
+ - When used as an output, the component only impacts the return signature of the user function.
817
+
818
+ The code snippet below is accurate in cases where the component is used as both an input and an output.
819
+
820
+ - **As output:** Is passed, the preprocessed input data sent to the user's function in the backend.
821
+
822
+
823
+ ```python
824
+ def predict(
825
+ value: typing.Any
826
+ ) -> Unknown:
827
+ return value
828
+ ```
829
+
app.py CHANGED
@@ -65,4 +65,4 @@ with gr.Blocks() as demo:
65
 
66
 
67
  if __name__ == "__main__":
68
- demo.launch()
 
65
 
66
 
67
  if __name__ == "__main__":
68
+ demo.launch(ssr_mode=True)
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': 'bool | None', 'default': 'False', 'description': None}, 'xterm_allow_transparency': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_alt_click_moves_cursor': {'type': 'bool | None', 'default': 'True', 'description': None}, 'xterm_convert_eol': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_cursor_blink': {'type': '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': 'int | None', 'default': '1', 'description': None}, 'xterm_custom_glyphs': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_disable_stdin': {'type': 'bool | None', 'default': 'True', 'description': None}, 'xterm_document_override': {'type': 'Any | None', 'default': 'None', 'description': None}, 'xterm_draw_bold_text_in_bright_colors': {'type': 'bool | None', 'default': 'True', 'description': None}, 'xterm_fast_scroll_modifier': {'type': '"none" | "alt" | "ctrl" | "shift" | None', 'default': '"alt"', 'description': None}, 'xterm_fast_scroll_sensitivity': {'type': 'int | None', 'default': '1', 'description': None}, 'xterm_font_family': {'type': 'str | None', 'default': '"courier-new, courier, monospace"', 'description': None}, 'xterm_font_size': {'type': 'int | None', 'default': '15', 'description': None}, 'xterm_font_weight': {'type': '"normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900"\n | None', 'default': '"normal"', 'description': None}, 'xterm_font_weight_bold': {'type': '"normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900"\n | None', 'default': '"bold"', 'description': None}, 'xterm_ignore_bracketed_paste_mode': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_letter_spacing': {'type': 'float | None', 'default': '0', 'description': None}, 'xterm_line_height': {'type': 'float | None', 'default': '1.0', 'description': None}, 'xterm_log_level': {'type': '"trace" | "debug" | "info" | "warn" | "error" | "off" | None', 'default': '"info"', 'description': None}, 'xterm_mac_option_click_forces_selection': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_mac_option_is_meta': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_minimum_contrast_ratio': {'type': 'int | None', 'default': '1', 'description': None}, 'xterm_overview_ruler_width': {'type': 'int | None', 'default': '0', 'description': None}, 'xterm_rescale_overlapping_glyphs': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_screen_reader_mode': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_scroll_on_user_input': {'type': 'bool | None', 'default': 'True', 'description': None}, 'xterm_scroll_sensitivity': {'type': 'int | None', 'default': '1', 'description': None}, 'xterm_scrollback': {'type': 'int | None', 'default': '1000', 'description': None}, 'xterm_smooth_scroll_duration': {'type': 'int | None', 'default': '0', 'description': None}, 'xterm_tab_stop_width': {'type': 'int | None', 'default': '8', 'description': None}, 'xterm_windows_mode': {'type': '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': '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
 
@@ -105,7 +105,7 @@ with gr.Blocks() as demo:
105
 
106
 
107
  if __name__ == "__main__":
108
- demo.launch()
109
 
110
  ```
111
  """, elem_classes=["md-custom"], header_links=True)
@@ -142,7 +142,7 @@ The code snippet below is accurate in cases where the component is used as both
142
 
143
  ```python
144
  def predict(
145
- value: Any
146
  ) -> Unknown:
147
  return value
148
  ```
 
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
 
 
105
 
106
 
107
  if __name__ == "__main__":
108
+ demo.launch(ssr_mode=True)
109
 
110
  ```
111
  """, elem_classes=["md-custom"], header_links=True)
 
142
 
143
  ```python
144
  def predict(
145
+ value: typing.Any
146
  ) -> Unknown:
147
  return value
148
  ```
src/.gitignore CHANGED
@@ -8,4 +8,6 @@ __tmp/*
8
  *.pyi
9
  node_modules
10
  test.log
11
- .DS_Store
 
 
 
8
  *.pyi
9
  node_modules
10
  test.log
11
+ .DS_Store
12
+ backend/gradio_log/templates
13
+ demo/space.py
src/README.md CHANGED
@@ -80,7 +80,7 @@ with gr.Blocks() as demo:
80
 
81
 
82
  if __name__ == "__main__":
83
- demo.launch()
84
 
85
  ```
86
 
@@ -142,7 +142,7 @@ bool
142
  <td align="left" style="width: 25%;">
143
 
144
  ```python
145
- bool | None
146
  ```
147
 
148
  </td>
@@ -155,7 +155,7 @@ bool | None
155
  <td align="left" style="width: 25%;">
156
 
157
  ```python
158
- bool | None
159
  ```
160
 
161
  </td>
@@ -168,7 +168,7 @@ bool | None
168
  <td align="left" style="width: 25%;">
169
 
170
  ```python
171
- bool | None
172
  ```
173
 
174
  </td>
@@ -181,7 +181,7 @@ bool | None
181
  <td align="left" style="width: 25%;">
182
 
183
  ```python
184
- bool | None
185
  ```
186
 
187
  </td>
@@ -194,7 +194,7 @@ bool | None
194
  <td align="left" style="width: 25%;">
195
 
196
  ```python
197
- bool | None
198
  ```
199
 
200
  </td>
@@ -233,7 +233,7 @@ bool | None
233
  <td align="left" style="width: 25%;">
234
 
235
  ```python
236
- int | None
237
  ```
238
 
239
  </td>
@@ -246,7 +246,7 @@ int | None
246
  <td align="left" style="width: 25%;">
247
 
248
  ```python
249
- bool | None
250
  ```
251
 
252
  </td>
@@ -259,7 +259,7 @@ bool | None
259
  <td align="left" style="width: 25%;">
260
 
261
  ```python
262
- bool | None
263
  ```
264
 
265
  </td>
@@ -272,7 +272,7 @@ bool | None
272
  <td align="left" style="width: 25%;">
273
 
274
  ```python
275
- Any | None
276
  ```
277
 
278
  </td>
@@ -285,7 +285,7 @@ Any | None
285
  <td align="left" style="width: 25%;">
286
 
287
  ```python
288
- bool | None
289
  ```
290
 
291
  </td>
@@ -298,7 +298,9 @@ bool | None
298
  <td align="left" style="width: 25%;">
299
 
300
  ```python
301
- "none" | "alt" | "ctrl" | "shift" | None
 
 
302
  ```
303
 
304
  </td>
@@ -311,7 +313,7 @@ bool | None
311
  <td align="left" style="width: 25%;">
312
 
313
  ```python
314
- int | None
315
  ```
316
 
317
  </td>
@@ -324,7 +326,7 @@ int | None
324
  <td align="left" style="width: 25%;">
325
 
326
  ```python
327
- str | None
328
  ```
329
 
330
  </td>
@@ -337,7 +339,7 @@ str | None
337
  <td align="left" style="width: 25%;">
338
 
339
  ```python
340
- int | None
341
  ```
342
 
343
  </td>
@@ -350,7 +352,22 @@ int | None
350
  <td align="left" style="width: 25%;">
351
 
352
  ```python
353
- "normal"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  | "bold"
355
  | "100"
356
  | "200"
@@ -360,8 +377,9 @@ int | None
360
  | "600"
361
  | "700"
362
  | "800"
363
- | "900"
364
- | None
 
365
  ```
366
 
367
  </td>
@@ -374,7 +392,22 @@ int | None
374
  <td align="left" style="width: 25%;">
375
 
376
  ```python
377
- "normal"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
  | "bold"
379
  | "100"
380
  | "200"
@@ -384,8 +417,9 @@ int | None
384
  | "600"
385
  | "700"
386
  | "800"
387
- | "900"
388
- | None
 
389
  ```
390
 
391
  </td>
@@ -398,7 +432,7 @@ int | None
398
  <td align="left" style="width: 25%;">
399
 
400
  ```python
401
- bool | None
402
  ```
403
 
404
  </td>
@@ -411,7 +445,7 @@ bool | None
411
  <td align="left" style="width: 25%;">
412
 
413
  ```python
414
- float | None
415
  ```
416
 
417
  </td>
@@ -424,7 +458,7 @@ float | None
424
  <td align="left" style="width: 25%;">
425
 
426
  ```python
427
- float | None
428
  ```
429
 
430
  </td>
@@ -437,7 +471,14 @@ float | None
437
  <td align="left" style="width: 25%;">
438
 
439
  ```python
440
- "trace" | "debug" | "info" | "warn" | "error" | "off" | None
 
 
 
 
 
 
 
441
  ```
442
 
443
  </td>
@@ -450,7 +491,7 @@ float | None
450
  <td align="left" style="width: 25%;">
451
 
452
  ```python
453
- bool | None
454
  ```
455
 
456
  </td>
@@ -463,7 +504,7 @@ bool | None
463
  <td align="left" style="width: 25%;">
464
 
465
  ```python
466
- bool | None
467
  ```
468
 
469
  </td>
@@ -476,7 +517,7 @@ bool | None
476
  <td align="left" style="width: 25%;">
477
 
478
  ```python
479
- int | None
480
  ```
481
 
482
  </td>
@@ -489,7 +530,7 @@ int | None
489
  <td align="left" style="width: 25%;">
490
 
491
  ```python
492
- int | None
493
  ```
494
 
495
  </td>
@@ -502,7 +543,7 @@ int | None
502
  <td align="left" style="width: 25%;">
503
 
504
  ```python
505
- bool | None
506
  ```
507
 
508
  </td>
@@ -515,7 +556,7 @@ bool | None
515
  <td align="left" style="width: 25%;">
516
 
517
  ```python
518
- bool | None
519
  ```
520
 
521
  </td>
@@ -528,7 +569,7 @@ bool | None
528
  <td align="left" style="width: 25%;">
529
 
530
  ```python
531
- bool | None
532
  ```
533
 
534
  </td>
@@ -541,7 +582,7 @@ bool | None
541
  <td align="left" style="width: 25%;">
542
 
543
  ```python
544
- int | None
545
  ```
546
 
547
  </td>
@@ -554,7 +595,7 @@ int | None
554
  <td align="left" style="width: 25%;">
555
 
556
  ```python
557
- int | None
558
  ```
559
 
560
  </td>
@@ -567,7 +608,7 @@ int | None
567
  <td align="left" style="width: 25%;">
568
 
569
  ```python
570
- int | None
571
  ```
572
 
573
  </td>
@@ -580,7 +621,7 @@ int | None
580
  <td align="left" style="width: 25%;">
581
 
582
  ```python
583
- int | None
584
  ```
585
 
586
  </td>
@@ -593,7 +634,7 @@ int | None
593
  <td align="left" style="width: 25%;">
594
 
595
  ```python
596
- bool | None
597
  ```
598
 
599
  </td>
@@ -781,7 +822,7 @@ The code snippet below is accurate in cases where the component is used as both
781
 
782
  ```python
783
  def predict(
784
- value: Any
785
  ) -> Unknown:
786
  return value
787
  ```
 
80
 
81
 
82
  if __name__ == "__main__":
83
+ demo.launch(ssr_mode=True)
84
 
85
  ```
86
 
 
142
  <td align="left" style="width: 25%;">
143
 
144
  ```python
145
+ typing.Optional[bool][bool, None]
146
  ```
147
 
148
  </td>
 
155
  <td align="left" style="width: 25%;">
156
 
157
  ```python
158
+ typing.Optional[bool][bool, None]
159
  ```
160
 
161
  </td>
 
168
  <td align="left" style="width: 25%;">
169
 
170
  ```python
171
+ typing.Optional[bool][bool, None]
172
  ```
173
 
174
  </td>
 
181
  <td align="left" style="width: 25%;">
182
 
183
  ```python
184
+ typing.Optional[bool][bool, None]
185
  ```
186
 
187
  </td>
 
194
  <td align="left" style="width: 25%;">
195
 
196
  ```python
197
+ typing.Optional[bool][bool, None]
198
  ```
199
 
200
  </td>
 
233
  <td align="left" style="width: 25%;">
234
 
235
  ```python
236
+ typing.Optional[int][int, None]
237
  ```
238
 
239
  </td>
 
246
  <td align="left" style="width: 25%;">
247
 
248
  ```python
249
+ typing.Optional[bool][bool, None]
250
  ```
251
 
252
  </td>
 
259
  <td align="left" style="width: 25%;">
260
 
261
  ```python
262
+ typing.Optional[bool][bool, None]
263
  ```
264
 
265
  </td>
 
272
  <td align="left" style="width: 25%;">
273
 
274
  ```python
275
+ typing.Optional[typing.Any][typing.Any, None]
276
  ```
277
 
278
  </td>
 
285
  <td align="left" style="width: 25%;">
286
 
287
  ```python
288
+ typing.Optional[bool][bool, None]
289
  ```
290
 
291
  </td>
 
298
  <td align="left" style="width: 25%;">
299
 
300
  ```python
301
+ typing.Optional[
302
+ typing.Literal["none", "alt", "ctrl", "shift"]
303
+ ]["none" | "alt" | "ctrl" | "shift", None]
304
  ```
305
 
306
  </td>
 
313
  <td align="left" style="width: 25%;">
314
 
315
  ```python
316
+ typing.Optional[int][int, None]
317
  ```
318
 
319
  </td>
 
326
  <td align="left" style="width: 25%;">
327
 
328
  ```python
329
+ typing.Optional[str][str, None]
330
  ```
331
 
332
  </td>
 
339
  <td align="left" style="width: 25%;">
340
 
341
  ```python
342
+ typing.Optional[int][int, None]
343
  ```
344
 
345
  </td>
 
352
  <td align="left" style="width: 25%;">
353
 
354
  ```python
355
+ typing.Optional[
356
+ typing.Literal[
357
+ "normal",
358
+ "bold",
359
+ "100",
360
+ "200",
361
+ "300",
362
+ "400",
363
+ "500",
364
+ "600",
365
+ "700",
366
+ "800",
367
+ "900",
368
+ ]
369
+ ][
370
+ "normal"
371
  | "bold"
372
  | "100"
373
  | "200"
 
377
  | "600"
378
  | "700"
379
  | "800"
380
+ | "900",
381
+ None,
382
+ ]
383
  ```
384
 
385
  </td>
 
392
  <td align="left" style="width: 25%;">
393
 
394
  ```python
395
+ typing.Optional[
396
+ typing.Literal[
397
+ "normal",
398
+ "bold",
399
+ "100",
400
+ "200",
401
+ "300",
402
+ "400",
403
+ "500",
404
+ "600",
405
+ "700",
406
+ "800",
407
+ "900",
408
+ ]
409
+ ][
410
+ "normal"
411
  | "bold"
412
  | "100"
413
  | "200"
 
417
  | "600"
418
  | "700"
419
  | "800"
420
+ | "900",
421
+ None,
422
+ ]
423
  ```
424
 
425
  </td>
 
432
  <td align="left" style="width: 25%;">
433
 
434
  ```python
435
+ typing.Optional[bool][bool, None]
436
  ```
437
 
438
  </td>
 
445
  <td align="left" style="width: 25%;">
446
 
447
  ```python
448
+ typing.Optional[float][float, None]
449
  ```
450
 
451
  </td>
 
458
  <td align="left" style="width: 25%;">
459
 
460
  ```python
461
+ typing.Optional[float][float, None]
462
  ```
463
 
464
  </td>
 
471
  <td align="left" style="width: 25%;">
472
 
473
  ```python
474
+ typing.Optional[
475
+ typing.Literal[
476
+ "trace", "debug", "info", "warn", "error", "off"
477
+ ]
478
+ ][
479
+ "trace" | "debug" | "info" | "warn" | "error" | "off",
480
+ None,
481
+ ]
482
  ```
483
 
484
  </td>
 
491
  <td align="left" style="width: 25%;">
492
 
493
  ```python
494
+ typing.Optional[bool][bool, None]
495
  ```
496
 
497
  </td>
 
504
  <td align="left" style="width: 25%;">
505
 
506
  ```python
507
+ typing.Optional[bool][bool, None]
508
  ```
509
 
510
  </td>
 
517
  <td align="left" style="width: 25%;">
518
 
519
  ```python
520
+ typing.Optional[int][int, None]
521
  ```
522
 
523
  </td>
 
530
  <td align="left" style="width: 25%;">
531
 
532
  ```python
533
+ typing.Optional[int][int, None]
534
  ```
535
 
536
  </td>
 
543
  <td align="left" style="width: 25%;">
544
 
545
  ```python
546
+ typing.Optional[bool][bool, None]
547
  ```
548
 
549
  </td>
 
556
  <td align="left" style="width: 25%;">
557
 
558
  ```python
559
+ typing.Optional[bool][bool, None]
560
  ```
561
 
562
  </td>
 
569
  <td align="left" style="width: 25%;">
570
 
571
  ```python
572
+ typing.Optional[bool][bool, None]
573
  ```
574
 
575
  </td>
 
582
  <td align="left" style="width: 25%;">
583
 
584
  ```python
585
+ typing.Optional[int][int, None]
586
  ```
587
 
588
  </td>
 
595
  <td align="left" style="width: 25%;">
596
 
597
  ```python
598
+ typing.Optional[int][int, None]
599
  ```
600
 
601
  </td>
 
608
  <td align="left" style="width: 25%;">
609
 
610
  ```python
611
+ typing.Optional[int][int, None]
612
  ```
613
 
614
  </td>
 
621
  <td align="left" style="width: 25%;">
622
 
623
  ```python
624
+ typing.Optional[int][int, None]
625
  ```
626
 
627
  </td>
 
634
  <td align="left" style="width: 25%;">
635
 
636
  ```python
637
+ typing.Optional[bool][bool, None]
638
  ```
639
 
640
  </td>
 
822
 
823
  ```python
824
  def predict(
825
+ value: typing.Any
826
  ) -> Unknown:
827
  return value
828
  ```
src/backend/gradio_log/templates/component/index.js CHANGED
The diff for this file is too large to render. See raw diff
 
src/backend/gradio_log/templates/component/style.css CHANGED
The diff for this file is too large to render. See raw diff
 
src/demo/app.py CHANGED
@@ -65,4 +65,4 @@ with gr.Blocks() as demo:
65
 
66
 
67
  if __name__ == "__main__":
68
- demo.launch()
 
65
 
66
 
67
  if __name__ == "__main__":
68
+ demo.launch(ssr_mode=True)
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': 'bool | None', 'default': 'False', 'description': None}, 'xterm_allow_transparency': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_alt_click_moves_cursor': {'type': 'bool | None', 'default': 'True', 'description': None}, 'xterm_convert_eol': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_cursor_blink': {'type': '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': 'int | None', 'default': '1', 'description': None}, 'xterm_custom_glyphs': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_disable_stdin': {'type': 'bool | None', 'default': 'True', 'description': None}, 'xterm_document_override': {'type': 'Any | None', 'default': 'None', 'description': None}, 'xterm_draw_bold_text_in_bright_colors': {'type': 'bool | None', 'default': 'True', 'description': None}, 'xterm_fast_scroll_modifier': {'type': '"none" | "alt" | "ctrl" | "shift" | None', 'default': '"alt"', 'description': None}, 'xterm_fast_scroll_sensitivity': {'type': 'int | None', 'default': '1', 'description': None}, 'xterm_font_family': {'type': 'str | None', 'default': '"courier-new, courier, monospace"', 'description': None}, 'xterm_font_size': {'type': 'int | None', 'default': '15', 'description': None}, 'xterm_font_weight': {'type': '"normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900"\n | None', 'default': '"normal"', 'description': None}, 'xterm_font_weight_bold': {'type': '"normal"\n | "bold"\n | "100"\n | "200"\n | "300"\n | "400"\n | "500"\n | "600"\n | "700"\n | "800"\n | "900"\n | None', 'default': '"bold"', 'description': None}, 'xterm_ignore_bracketed_paste_mode': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_letter_spacing': {'type': 'float | None', 'default': '0', 'description': None}, 'xterm_line_height': {'type': 'float | None', 'default': '1.0', 'description': None}, 'xterm_log_level': {'type': '"trace" | "debug" | "info" | "warn" | "error" | "off" | None', 'default': '"info"', 'description': None}, 'xterm_mac_option_click_forces_selection': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_mac_option_is_meta': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_minimum_contrast_ratio': {'type': 'int | None', 'default': '1', 'description': None}, 'xterm_overview_ruler_width': {'type': 'int | None', 'default': '0', 'description': None}, 'xterm_rescale_overlapping_glyphs': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_screen_reader_mode': {'type': 'bool | None', 'default': 'False', 'description': None}, 'xterm_scroll_on_user_input': {'type': 'bool | None', 'default': 'True', 'description': None}, 'xterm_scroll_sensitivity': {'type': 'int | None', 'default': '1', 'description': None}, 'xterm_scrollback': {'type': 'int | None', 'default': '1000', 'description': None}, 'xterm_smooth_scroll_duration': {'type': 'int | None', 'default': '0', 'description': None}, 'xterm_tab_stop_width': {'type': 'int | None', 'default': '8', 'description': None}, 'xterm_windows_mode': {'type': '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': '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
 
@@ -105,7 +105,7 @@ with gr.Blocks() as demo:
105
 
106
 
107
  if __name__ == "__main__":
108
- demo.launch()
109
 
110
  ```
111
  """, elem_classes=["md-custom"], header_links=True)
@@ -142,7 +142,7 @@ The code snippet below is accurate in cases where the component is used as both
142
 
143
  ```python
144
  def predict(
145
- value: Any
146
  ) -> Unknown:
147
  return value
148
  ```
 
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
 
 
105
 
106
 
107
  if __name__ == "__main__":
108
+ demo.launch(ssr_mode=True)
109
 
110
  ```
111
  """, elem_classes=["md-custom"], header_links=True)
 
142
 
143
  ```python
144
  def predict(
145
+ value: typing.Any
146
  ) -> Unknown:
147
  return value
148
  ```
src/frontend/Index.svelte CHANGED
@@ -6,8 +6,8 @@
6
  import { Block } from "@gradio/atoms";
7
  import { StatusTracker } from "@gradio/statustracker";
8
  import type { LoadingStatus } from "@gradio/statustracker";
9
- import xterm from "@xterm/xterm";
10
- import addon from "xterm-addon-fit";
11
  import { onMount } from "svelte";
12
 
13
  export let gradio: Gradio<{
@@ -74,7 +74,7 @@
74
  };
75
 
76
  onMount(() => {
77
- term = new xterm.Terminal({
78
  theme,
79
  allowProposedApi: xterm_allow_proposed_api,
80
  allowTransparency: xterm_allow_transparency,
@@ -113,7 +113,7 @@
113
  windowsMode: xterm_windows_mode,
114
  });
115
  term.open(termNode);
116
- const fitAddon = new addon.FitAddon();
117
  term.loadAddon(fitAddon);
118
  setTimeout(() => {
119
  fitAddon.fit();
 
6
  import { Block } from "@gradio/atoms";
7
  import { StatusTracker } from "@gradio/statustracker";
8
  import type { LoadingStatus } from "@gradio/statustracker";
9
+ import { Terminal } from "@xterm/xterm";
10
+ import { FitAddon } from "xterm-addon-fit";
11
  import { onMount } from "svelte";
12
 
13
  export let gradio: Gradio<{
 
74
  };
75
 
76
  onMount(() => {
77
+ term = new Terminal({
78
  theme,
79
  allowProposedApi: xterm_allow_proposed_api,
80
  allowTransparency: xterm_allow_transparency,
 
113
  windowsMode: xterm_windows_mode,
114
  });
115
  term.open(termNode);
116
+ const fitAddon = new FitAddon();
117
  term.loadAddon(fitAddon);
118
  setTimeout(() => {
119
  fitAddon.fit();
src/frontend/package-lock.json CHANGED
The diff for this file is too large to render. See raw diff
 
src/frontend/package.json CHANGED
@@ -8,15 +8,21 @@
8
  "private": false,
9
  "main_changeset": true,
10
  "exports": {
11
- ".": "./Index.svelte",
12
- "./package.json": "./package.json"
 
 
13
  },
14
  "dependencies": {
15
- "@gradio/atoms": "0.6.1",
16
- "@gradio/icons": "0.3.4",
17
- "@gradio/statustracker": "0.4.10",
18
- "@gradio/utils": "0.3.0",
19
  "@xterm/xterm": "^5.5.0",
20
  "xterm-addon-fit": "^0.8.0"
 
 
 
 
21
  }
22
  }
 
8
  "private": false,
9
  "main_changeset": true,
10
  "exports": {
11
+ "./package.json": "./package.json",
12
+ ".": {
13
+ "gradio": "./Index.svelte"
14
+ }
15
  },
16
  "dependencies": {
17
+ "@gradio/atoms": "0.11.0",
18
+ "@gradio/icons": "0.8.1",
19
+ "@gradio/statustracker": "0.9.4",
20
+ "@gradio/utils": "0.7.0",
21
  "@xterm/xterm": "^5.5.0",
22
  "xterm-addon-fit": "^0.8.0"
23
+ },
24
+ "devDependencies": {
25
+ "@gradio/preview": "^0.13.0",
26
+ "@tsconfig/svelte": "^5.0.4"
27
  }
28
  }
src/frontend/tsconfig.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "extends": "@tsconfig/svelte/tsconfig.json",
3
+ }
src/pyproject.toml CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
8
 
9
  [project]
10
  name = "gradio_log"
11
- version = "0.0.4"
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"
@@ -23,7 +23,7 @@ keywords = [
23
  "gradio_print_log",
24
  ]
25
  # Add dependencies here
26
- dependencies = ["gradio>=4.0,<5.0"]
27
  classifiers = [
28
  'Development Status :: 3 - Alpha',
29
  'License :: OSI Approved :: Apache Software License',
 
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"
 
23
  "gradio_print_log",
24
  ]
25
  # Add dependencies here
26
+ dependencies = ["gradio>=4.0,<6.0"]
27
  classifiers = [
28
  'Development Status :: 3 - Alpha',
29
  'License :: OSI Approved :: Apache Software License',