ka1kuk commited on
Commit
464d0c9
1 Parent(s): 1470d33

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -9
main.py CHANGED
@@ -27,19 +27,17 @@ model = model.bind(
27
  function_call={"name": "get_current_weather"},
28
  )
29
 
30
- # Function to be called by the Gradio interface
31
- def get_weather(user_input):
32
  result = model.invoke(user_input)
33
  return result
34
 
35
- # Create the Gradio interface
36
  iface = gr.Interface(
37
- fn=get_weather,
38
- inputs=gr.inputs.Textbox(lines=2, placeholder="Enter Location and Unit (e.g., 'San Francisco, CA', 'celsius')"),
39
- outputs="text",
40
  title="Weather Information",
41
- description="Enter a location to get the current weather."
42
  )
43
 
44
- # Launch the application
45
- iface.launch()
 
27
  function_call={"name": "get_current_weather"},
28
  )
29
 
30
+ def get_weather(location, unit):
31
+ user_input = f"{location}, {unit}"
32
  result = model.invoke(user_input)
33
  return result
34
 
 
35
  iface = gr.Interface(
36
+ fn=get_weather,
37
+ inputs=[gr.Textbox(label="Location (e.g., 'San Francisco, CA')"), gr.Radio(choices=["celsius", "fahrenheit"], label="Unit")],
38
+ outputs=gr.Text(label="Weather Information"),
39
  title="Weather Information",
40
+ description="Enter a location and select the unit to get the current weather."
41
  )
42
 
43
+ iface.launch()