Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /gradio-app_gradio /gradio /cli /commands /display.py
| from __future__ import annotations | |
| import time | |
| from types import TracebackType | |
| from rich.live import Live | |
| from rich.panel import Panel | |
| class LivePanelDisplay: | |
| def __init__(self, msg: str | None = None) -> None: | |
| self.lines = [msg] if msg else [] | |
| self._panel = Live(Panel("\n".join(self.lines)), refresh_per_second=5) | |
| def update(self, msg: str, add_sleep: float | None = None): | |
| self.lines.append(msg) | |
| self._panel.update(Panel("\n".join(self.lines))) | |
| if add_sleep: | |
| time.sleep(add_sleep) | |
| def __enter__(self) -> LivePanelDisplay: | |
| self._panel.__enter__() | |
| return self | |
| def __exit__( | |
| self, | |
| exc_type: type[BaseException] | None, | |
| exc_val: BaseException | None, | |
| exc_tb: TracebackType | None, | |
| ) -> None: | |
| self._panel.stop() | |
Xet Storage Details
- Size:
- 845 Bytes
- Xet hash:
- 9b3847838f19daa4809190746bc763133f47f092bd66b935bd3a56ef5d3ecb72
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.