Spaces:
Sleeping
Sleeping
from app import mcp_server # Imports your main backend JSON-RPC handler | |
import gradio as gr | |
demo = gr.Interface( | |
fn=mcp_server, | |
inputs=gr.Textbox(label="JSON-RPC Input", lines=20, info="Paste your JSON-RPC request here."), | |
outputs=gr.Textbox(label="Chatbot Response", lines=20), | |
title="Township Business Chatbot UI", | |
description="This demo UI connects to the Township Directory backend. Use it to register businesses or get nearby listings using JSON-RPC payloads.", | |
examples=[ | |
[ | |
"""{ | |
"jsonrpc": "2.0", | |
"method": "registerBusiness", | |
"params": { | |
"name": "Kasi Kitchen", | |
"description": "Delicious township meals", | |
"address": "999 Spaza Road", | |
"phone": "0721234567", | |
"latitude": "-26.2041", | |
"longitude": "28.0473" | |
}, | |
"id": 1 | |
}""" | |
], | |
[ | |
"""{ | |
"jsonrpc": "2.0", | |
"method": "getNearbyBusinesses", | |
"params": { | |
"latitude": "-26.2041", | |
"longitude": "28.0473", | |
"radius_km": 5 | |
}, | |
"id": 2 | |
}""" | |
] | |
], | |
theme="soft", # Optional aesthetic | |
) | |
demo.launch(share=True) | |