Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from tools import get_coords_from_address | |
| # --- Tool 1: Geocoding Interface --- | |
| geocoding_interface = gr.Interface( | |
| fn=get_coords_from_address, | |
| inputs=[ | |
| gr.Textbox(label="Address", placeholder="e.g., 1600 Amphitheatre Parkway, Mountain View, CA") | |
| ], | |
| outputs=[ | |
| gr.Textbox(label="Coordinates (Lat, Lon)") | |
| ], | |
| title="Address to Coordinates", | |
| description="A tool to get the latitude and longitude for a given street address." | |
| ) | |
| # --- About Tab --- | |
| # It's good practice to have a home/about tab. We create it using gr.Blocks and gr.Markdown. | |
| with gr.Blocks() as about_tab: | |
| gr.Markdown(""" | |
| # π Geocalc MCP Server | |
| Welcome to the Geocalc MCP server. This application provides a collection of tools for geographic calculations. | |
| This server is designed to be used by AI models (like LLMs) to perform geo-related tasks. | |
| ## Available Tools | |
| - **Address Geocoding**: Converts a physical address into latitude and longitude coordinates. | |
| Use the tabs above to navigate to the desired tool. | |
| """) | |
| # --- Assemble the Tabbed Interface --- | |
| demo = gr.TabbedInterface( | |
| [about_tab, geocoding_interface], | |
| ["About", "Address Geocoding"], | |
| title="π Geocalc MCP Server" | |
| ) | |
| # --- Launch the Server --- | |
| if __name__ == "__main__": | |
| demo.launch(mcp_server=True) |