hermes-agent / app.py
D3AMON's picture
Upload app.py with huggingface_hub
0949d8a verified
Raw History Blame Contribute Delete
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()