Update main.py
Browse files
main.py
CHANGED
@@ -27,19 +27,17 @@ model = model.bind(
|
|
27 |
function_call={"name": "get_current_weather"},
|
28 |
)
|
29 |
|
30 |
-
|
31 |
-
|
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.
|
39 |
-
outputs="
|
40 |
title="Weather Information",
|
41 |
-
description="Enter a location to get the current weather."
|
42 |
)
|
43 |
|
44 |
-
|
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()
|
|