Spaces:
Configuration error
Configuration error
Download app.py from D3AMON/hermes-agent: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/D3AMON/hermes-agent/resolve/main/app.py
- Command line
-
hf download hf://spaces/D3AMON/hermes-agent/app.py
-
curl -L -o app.py https://huggingface.co/spaces/D3AMON/hermes-agent/resolve/main/app.py
1.07 kB
| import os | |
| import subprocess | |
| import time | |
| from huggingface_hub import HfApi, Repository | |
| import threading | |
| def sync_data(hf_token, repo_id, local_dir): | |
| """ | |
| Simulates a basic sync mechanism for persistence on Hugging Face. | |
| """ | |
| api = HfApi() | |
| while True: | |
| try: | |
| print("Syncing data to Hugging Face Dataset...") | |
| # This is a simplified version of the HermesFace persistence logic | |
| # In a real deployment, we'd use a more robust git-based sync | |
| time.sleep(300) # Sync every 5 minutes | |
| except Exception as e: | |
| print(f"Sync error: {e}") | |
| time.sleep(60) | |
| def main(): | |
| # Start the Hermes config generation | |
| subprocess.run(["python3", "/home/hermes/scripts/generate_config.py"], check=True) | |
| # Start the Hermes gateway in a separate thread or process | |
| print("Starting Hermes Gateway...") | |
| process = subprocess.Popen(["hermes", "gateway", "start", "--foreground"]) | |
| # Keep the main thread alive | |
| process.wait() | |
| if __name__ == "__main__": | |
| main() | |