Spaces:
Build error
Build error
Download src/logging.py from EmbodiedAgentInterface/backend: direct link, hf CLI and curl.
- Browser
- Download file 728 Bytes
-
https://huggingface.co/spaces/EmbodiedAgentInterface/backend/resolve/6fdb0a45ee9555060f045dc9b65a2d75cd150ae5/src/logging.py
- Command line
-
hf download hf://spaces/EmbodiedAgentInterface/backend@6fdb0a45ee9555060f045dc9b65a2d75cd150ae5/src/logging.py
-
curl -L -o logging.py https://huggingface.co/spaces/EmbodiedAgentInterface/backend/resolve/6fdb0a45ee9555060f045dc9b65a2d75cd150ae5/src/logging.py
728 Bytes
| import sys | |
| from src.envs import API | |
| class Logger: | |
| def __init__(self, filename): | |
| self.terminal = sys.stdout | |
| self.log = open(filename, "a+") | |
| def write(self, message): | |
| self.terminal.write(message) | |
| self.log.write(message) | |
| def flush(self): | |
| self.terminal.flush() | |
| self.log.flush() | |
| def isatty(self): | |
| return False | |
| def read_logs(): | |
| sys.stdout.flush() | |
| #API.upload_file( | |
| # path_or_fileobj="output.log", | |
| # path_in_repo="demo-backend.log", | |
| # repo_id="demo-leaderboard-backend/logs", | |
| # repo_type="dataset", | |
| #) | |
| with open("output.log", "r") as f: | |
| return f.read() | |
| LOGGER = Logger("output.log") | |