MHamdan's picture
Upload app.py with huggingface_hub
e45a3e3 verified
raw
history blame
1.36 kB
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()