Spaces:
Sleeping
Sleeping
import gradio as gr | |
from smolagents import load_tool | |
# Load the tool | |
journey_tool = load_tool("MHamdan/journey-metrics-tool", trust_remote_code=True) | |
def create_interface(): | |
return gr.Interface( | |
fn=journey_tool, | |
inputs=[ | |
gr.Textbox(label="Start Location", placeholder="Enter starting point"), | |
gr.Textbox(label="Destination Location", placeholder="Enter destination"), | |
gr.Dropdown( | |
choices=["driving", "walking", "bicycling", "transit", "plane"], | |
label="Transportation Mode", | |
value="driving" | |
) | |
], | |
outputs=gr.Textbox(label="Journey Details"), | |
title="Journey Metrics Calculator", | |
description="Calculate travel distance and time between two locations.", | |
examples=[ | |
["Montreal", "Toronto", "plane"], | |
["Vancouver", "Whistler", "driving"], | |
["Ottawa", "Kingston", "bicycling"], | |
["New York", "Los Angeles", "plane"], | |
["Sanaa", "Jeddah", "plane"], | |
["Sanaa", "Jeddah", "Car"], | |
["Sanaa", "Jeddah", "Bus"], | |
["Sanaa", "Jeddah", "Bicyle"], | |
["Sanaa", "Jeddah", "Walk"], | |
["London", "Paris", "train"] | |
] | |
) | |
# Create and launch the interface | |
iface = create_interface() | |
iface.launch() | |