MHamdan commited on
Commit
4a946af
·
verified ·
1 Parent(s): 52f892f

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +32 -4
app.py CHANGED
@@ -1,6 +1,34 @@
1
- from smolagents import launch_gradio_demo
2
- from tool import SimpleTool
3
 
4
- tool = SimpleTool()
 
5
 
6
- launch_gradio_demo(tool)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
+ import gradio as gr
3
+ from smolagents import load_tool
4
 
5
+ # Load the tool
6
+ journey_tool = load_tool("MHamdan/journey-metrics-tool", trust_remote_code=True)
7
+
8
+ def create_interface():
9
+ return gr.Interface(
10
+ fn=journey_tool,
11
+ inputs=[
12
+ gr.Textbox(label="Start Location", placeholder="Enter starting point"),
13
+ gr.Textbox(label="Destination Location", placeholder="Enter destination"),
14
+ gr.Dropdown(
15
+ choices=["driving", "walking", "bicycling", "transit", "plane"],
16
+ label="Transportation Mode",
17
+ value="driving"
18
+ )
19
+ ],
20
+ outputs=gr.Textbox(label="Journey Details"),
21
+ title="Journey Metrics Calculator",
22
+ description="Calculate travel distance and time between two locations.",
23
+ examples=[
24
+ ["Montreal", "Toronto", "plane"],
25
+ ["Vancouver", "Whistler", "driving"],
26
+ ["Ottawa", "Kingston", "bicycling"],
27
+ ["New York", "Los Angeles", "plane"],
28
+ ["London", "Paris", "train"]
29
+ ]
30
+ )
31
+
32
+ # Create and launch the interface
33
+ iface = create_interface()
34
+ iface.launch()