MHamdan commited on
Commit
e45a3e3
·
verified ·
1 Parent(s): 139193c

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +37 -4
app.py CHANGED
@@ -1,6 +1,39 @@
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
+ ["Sanaa", "Jeddah", "plane"],
29
+ ["Sanaa", "Jeddah", "Car"],
30
+ ["Sanaa", "Jeddah", "Bus"],
31
+ ["Sanaa", "Jeddah", "Bicyle"],
32
+ ["Sanaa", "Jeddah", "Walk"],
33
+ ["London", "Paris", "train"]
34
+ ]
35
+ )
36
+
37
+ # Create and launch the interface
38
+ iface = create_interface()
39
+ iface.launch()