CoolFace
Apppublic

Agents-MCP-Hackathon/ZeroGPU_Agent_Tools

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
server.py26 linesDownload Raw Back to root
1import asyncio2from mcp.server import Server3import requests4 5mools=[]6server = Server(name="ZeroGPU Agent Tools Server",version="1.0.0")7 8def zerogpu_agent_tools():9    def fetch_gradio_spaces():10        response = requests.get("https://huggingface.co/api/spaces?runtime=zero-a10g&sdk=gradio&sort=trendingScore&limit=100")11        data = response.json()12        gradio_spaces = [space['id'] for space in data if space.get('sdk') == "gradio" and space['runtime']['hardware']['current'] != "cpu-basic" and space['runtime']['hardware']['current'] != None]13        return gradio_spaces14    gradio_list=fetch_gradio_spaces()15 16    def add_space_tools():17        for sptool in gradio_list[:20]:18            mools.append(sptool)19    add_space_tools()20    return mools21 22generate_agent_tools = [{"name": "zerogpu_agent_tools","description": "Generates an array of ZeroGPU Gradio spaces for use as Agent Tools","input_schema": None,"output_schema": {"type": "array", "items": {"type": "string"}},"func": zerogpu_agent_tools}]23 24async def main():25    await server.run()26asyncio.run(main())