Spaces:
Sleeping
Sleeping
Download logs.py from vioott/BookMatchAI-Python-GeminiAPI: direct link, hf CLI and curl.
- Browser
- Download file 412 Bytes
-
https://huggingface.co/spaces/vioott/BookMatchAI-Python-GeminiAPI/resolve/704425d2b08c3260b7bbd3abbe488ba026610da2/logs.py
- Command line
-
hf download hf://spaces/vioott/BookMatchAI-Python-GeminiAPI@704425d2b08c3260b7bbd3abbe488ba026610da2/logs.py
-
curl -L -o logs.py https://huggingface.co/spaces/vioott/BookMatchAI-Python-GeminiAPI/resolve/704425d2b08c3260b7bbd3abbe488ba026610da2/logs.py
412 Bytes
| from datetime import datetime | |
| def save_log(user_id: int, history: dict, response: str): | |
| log_entry = ( | |
| f"[{datetime.now().isoformat(sep=' ', timespec='seconds')}]\n" | |
| f"Usuário: {user_id}\n" | |
| f"Histórico: {history}\n" | |
| f"Recomendação: {response.strip()}\n" | |
| f"{'-'*40}\n" | |
| ) | |
| with open("recommender.log", "a", encoding="utf-8") as f: | |
| f.write(log_entry) | |