{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: server_app"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["from gradio import Server\n", "from fastapi.responses import HTMLResponse\n", "\n", "app = Server()\n", "\n", "@app.mcp.tool(name=\"add\")\n", "@app.api(name=\"add\")\n", "def add(a: int, b: int) -> int:\n", " \"\"\"Add two numbers together.\"\"\"\n", " return a + b\n", "\n", "@app.mcp.tool(name=\"multiply\")\n", "@app.api(name=\"multiply\")\n", "def multiply(a: int, b: int) -> int:\n", " \"\"\"Multiply two numbers together.\"\"\"\n", " return a * b\n", "\n", "@app.get(\"/\", response_class=HTMLResponse)\n", "async def homepage():\n", " return \"\"\"\n", "\n", "\n", "