Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -953,32 +953,32 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
|
|
| 953 |
# "model": model_llm
|
| 954 |
# }).json()
|
| 955 |
|
| 956 |
-
def
|
| 957 |
-
|
| 958 |
-
|
| 959 |
-
|
| 960 |
-
|
| 961 |
-
|
| 962 |
-
|
| 963 |
-
|
|
|
|
|
|
|
|
|
|
| 964 |
|
| 965 |
functions = [
|
| 966 |
{
|
| 967 |
-
"name": "
|
| 968 |
-
"description": "
|
| 969 |
"parameters": {
|
| 970 |
"type": "object",
|
| 971 |
"properties": {
|
| 972 |
-
"
|
| 973 |
-
"type": "
|
| 974 |
-
"description": "The
|
| 975 |
-
},
|
| 976 |
-
"value2": {
|
| 977 |
-
"type": "integer",
|
| 978 |
-
"description": "The second decimal value to add. For example, 10",
|
| 979 |
},
|
|
|
|
| 980 |
},
|
| 981 |
-
"required": ["
|
| 982 |
},
|
| 983 |
}
|
| 984 |
]
|
|
@@ -989,7 +989,7 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
|
|
| 989 |
functions = functions,
|
| 990 |
function_choice = "auto",
|
| 991 |
function_call = {
|
| 992 |
-
"name": "
|
| 993 |
}
|
| 994 |
)
|
| 995 |
|
|
|
|
| 953 |
# "model": model_llm
|
| 954 |
# }).json()
|
| 955 |
|
| 956 |
+
def get_current_weather(location, unit):
|
| 957 |
+
params = {
|
| 958 |
+
'appid': '334f89b7998e8df818503b0f33085621',
|
| 959 |
+
'q': location,
|
| 960 |
+
'units': unit
|
| 961 |
+
}
|
| 962 |
+
response = requests.get('https://api.openweathermap.org/data/2.5/weather', params=params)
|
| 963 |
+
if response.status_code == 200:
|
| 964 |
+
return response.json()
|
| 965 |
+
else:
|
| 966 |
+
return None
|
| 967 |
|
| 968 |
functions = [
|
| 969 |
{
|
| 970 |
+
"name": "get_current_weather",
|
| 971 |
+
"description": "Get the current weather in a given location",
|
| 972 |
"parameters": {
|
| 973 |
"type": "object",
|
| 974 |
"properties": {
|
| 975 |
+
"location": {
|
| 976 |
+
"type": "string",
|
| 977 |
+
"description": "The city and state, e.g. San Francisco, CA",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 978 |
},
|
| 979 |
+
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
|
| 980 |
},
|
| 981 |
+
"required": ["location"],
|
| 982 |
},
|
| 983 |
}
|
| 984 |
]
|
|
|
|
| 989 |
functions = functions,
|
| 990 |
function_choice = "auto",
|
| 991 |
function_call = {
|
| 992 |
+
"name": "get_current_weather"
|
| 993 |
}
|
| 994 |
)
|
| 995 |
|