metadata
title: Brain
emoji: 🧠
colorFrom: pink
colorTo: purple
sdk: docker
pinned: false
🧠 Brain (Router) — Online AI Network
This Space is the router for your multi-Space AI network. It calls:
- Python AI Space → patch-first code fixes
- TTS Space → short spoken explanation
- (Later) STT streaming, Vision/OCR, Memory/RAG
Endpoints
- GET /health
- POST /warmup
- POST /code_help (see examples below)
Configure (Settings → Variables)
- PYTHON_AI_URL → e.g. https://-python_ai_space.hf.space
- TTS_URL → e.g. https://-tts_space.hf.space
- (optional) STT_URL, VISION_URL, MEMORY_URL
- (optional) PROMPT_BUDGET_BYTES=12000, MEMORY_BUDGET_BYTES=6000, VIEWPORT_MAX_LINES=60
Quick test (replace URLs)
curl -X POST https://<you>-brain.hf.space/code_help \
-H "content-type: application/json" \
-d '{
"utterance": "please fix the error and make it run",
"telemetry": {
"file": "main.py",
"lang": "python",
"cursor": {"l":88,"c":12},
"viewport": {"start":72,"end":110, "text":"def foo():\n return bar\n\nresult = foo()\nprint(reslt)\n"},
"diag": [{"l":90,"sev":"error","msg":"NameError: reslt is not defined"}],
"term": "Traceback... NameError: reslt"
},
"memory": {"short": [], "sess": ["Prefer list comprehensions."], "proj": []},
"response_mode": "patch"
}'