Spaces:
Sleeping
Sleeping
File size: 1,178 Bytes
4474c5c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import gradio as gr
import requests, threading, time
from datetime import datetime
PRIMARY = "162.243.238.36"
def announce():
while True:
try:
requests.post(f"http://{PRIMARY}:7861/mesh", json={
"action":"announce","node_id":"godbot-hf-space",
"role":"edge","ip":"huggingface.co","port":7860,
"models":[],"ram_mb":16000,"skills":0
}, timeout=8)
except: pass
time.sleep(55)
threading.Thread(target=announce, daemon=True).start()
def status():
try:
r = requests.get(f"http://{PRIMARY}:7861/mesh/ping", timeout=5).json()
c = requests.get(f"http://{PRIMARY}:7861/mesh/capabilities", timeout=5).json()
return f"GodBot Mesh Node - HuggingFace Space\nConnected: {r.get('node_id')}\nPrimary skills: {c.get('skills')} | Models: {len(c.get('models',[]))}\nUpdated: {datetime.utcnow().strftime('%H:%M UTC')}"
except Exception as e:
return f"Primary unreachable: {e}\nNode alive."
gr.Interface(fn=status, inputs=[], outputs=gr.Textbox(lines=5),
title="GodBot Mesh Node", description="Autonomous AI agent - free persistent compute").launch()
|