Spaces:
Sleeping
Sleeping
Download api.py from umar-30/Multi-agent-system: direct link, hf CLI and curl.
- Browser
- Download file 783 Bytes
-
https://huggingface.co/spaces/umar-30/Multi-agent-system/resolve/main/api.py
- Command line
-
hf download hf://spaces/umar-30/Multi-agent-system/api.py
-
curl -L -o api.py https://huggingface.co/spaces/umar-30/Multi-agent-system/resolve/main/api.py
783 Bytes
| from fastapi import FastAPI, HTTPException | |
| from pydantic import BaseModel | |
| from core.coordinator import Coordinator | |
| import uvicorn | |
| app = FastAPI(title="Multi-Agent System API") | |
| coordinator = Coordinator() | |
| class TaskRequest(BaseModel): | |
| task: str | |
| class TaskResponse(BaseModel): | |
| result: str | |
| async def root(): | |
| return {"message": "Multi-Agent System API is running"} | |
| async def execute_task(request: TaskRequest): | |
| try: | |
| result = coordinator.execute(request.task) | |
| return TaskResponse(result=result) | |
| except Exception as e: | |
| raise HTTPException(status_code=500, detail=str(e)) | |
| if __name__ == "__main__": | |
| uvicorn.run(app, host="0.0.0.0", port=8000) | |