Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -983,11 +983,11 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
|
|
| 983 |
# else:
|
| 984 |
# return "Function call successfull"
|
| 985 |
|
| 986 |
-
def book_enquiry(
|
| 987 |
landmark: str, zip_code: str, emirate: str, reason: str):
|
| 988 |
"""
|
| 989 |
This function asks the user for their details and books an enquiry for waste disposal.
|
| 990 |
-
@param
|
| 991 |
@param contact_number: The contact number of the user
|
| 992 |
@param street_address: The street address of the user
|
| 993 |
@param landmark: The landmark near the user's location
|
|
@@ -996,21 +996,27 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
|
|
| 996 |
@param reason: The reason for waste disposal enquiry
|
| 997 |
"""
|
| 998 |
|
| 999 |
-
if not all([
|
| 1000 |
return "You must provide your details to book an enquiry."
|
| 1001 |
else:
|
| 1002 |
-
enquiry = requests.post(
|
| 1003 |
"data":{
|
| 1004 |
-
"
|
| 1005 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1006 |
})
|
| 1007 |
|
| 1008 |
if enquiry.status_code == 200:
|
| 1009 |
-
print(f"Booking enquiry for {
|
| 1010 |
-
return f"Booking enquiry for {
|
| 1011 |
else:
|
| 1012 |
-
print(f"Booking enquiry for {
|
| 1013 |
-
return f"Booking enquiry for {
|
| 1014 |
|
| 1015 |
# def get_current_weather(location: str, unit: str):
|
| 1016 |
# """
|
|
@@ -1069,9 +1075,9 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
|
|
| 1069 |
"parameters": {
|
| 1070 |
"type": "object",
|
| 1071 |
"properties": {
|
| 1072 |
-
"
|
| 1073 |
"type": "string",
|
| 1074 |
-
"description": "The user's
|
| 1075 |
},
|
| 1076 |
"contact_number": {
|
| 1077 |
"type": "string",
|
|
@@ -1098,7 +1104,7 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
|
|
| 1098 |
"description": "The user's reason provided by him/her for the booking enquiry",
|
| 1099 |
},
|
| 1100 |
},
|
| 1101 |
-
"required": ["
|
| 1102 |
},
|
| 1103 |
}
|
| 1104 |
]
|
|
@@ -1171,7 +1177,7 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
|
|
| 1171 |
arguments_dict = json.loads(arguments_str)
|
| 1172 |
|
| 1173 |
function_response = book_enquiry(
|
| 1174 |
-
|
| 1175 |
contact_number=arguments_dict["contact_number"],
|
| 1176 |
street_address=arguments_dict["street_address"],
|
| 1177 |
landmark=arguments_dict["landmark"],
|
|
@@ -1182,7 +1188,7 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
|
|
| 1182 |
|
| 1183 |
print("FUNCTION_RESPONSE:", function_response)
|
| 1184 |
# print("ARGUMENTS VALUES:", arguments_dict["location"], arguments_dict["unit"])
|
| 1185 |
-
print(f"ARGUMENTS VALUES:
|
| 1186 |
|
| 1187 |
# messages.append(comp)
|
| 1188 |
# messages.append({
|
|
|
|
| 983 |
# else:
|
| 984 |
# return "Function call successfull"
|
| 985 |
|
| 986 |
+
def book_enquiry(full_name: str, contact_number: str, street_address: str,
|
| 987 |
landmark: str, zip_code: str, emirate: str, reason: str):
|
| 988 |
"""
|
| 989 |
This function asks the user for their details and books an enquiry for waste disposal.
|
| 990 |
+
@param full_name: The full name of the user
|
| 991 |
@param contact_number: The contact number of the user
|
| 992 |
@param street_address: The street address of the user
|
| 993 |
@param landmark: The landmark near the user's location
|
|
|
|
| 996 |
@param reason: The reason for waste disposal enquiry
|
| 997 |
"""
|
| 998 |
|
| 999 |
+
if not all([full_name, contact_number, street_address, landmark, zip_code, emirate, reason]):
|
| 1000 |
return "You must provide your details to book an enquiry."
|
| 1001 |
else:
|
| 1002 |
+
enquiry = requests.post(endpoint, json={
|
| 1003 |
"data":{
|
| 1004 |
+
"full_name": full_name,
|
| 1005 |
+
"contact_number": contact_number,
|
| 1006 |
+
"street_address": street_address,
|
| 1007 |
+
"landmark": landmark,
|
| 1008 |
+
"zip_code": zip_code,
|
| 1009 |
+
"emirate": emirate,
|
| 1010 |
+
"reason_for_visit": reason_for_visit,
|
| 1011 |
+
},
|
| 1012 |
})
|
| 1013 |
|
| 1014 |
if enquiry.status_code == 200:
|
| 1015 |
+
print(f"Booking enquiry for {full_name} with contact number {contact_number}.")
|
| 1016 |
+
return f"Booking enquiry for {full_name} with contact number {contact_number} successful!. We'll get back to you shortly!"
|
| 1017 |
else:
|
| 1018 |
+
print(f"Booking enquiry for {full_name} with contact number {contact_number}.")
|
| 1019 |
+
return f"Booking enquiry for {full_name} with contact number {contact_number} declined!. Please try again or Contact our support team"
|
| 1020 |
|
| 1021 |
# def get_current_weather(location: str, unit: str):
|
| 1022 |
# """
|
|
|
|
| 1075 |
"parameters": {
|
| 1076 |
"type": "object",
|
| 1077 |
"properties": {
|
| 1078 |
+
"full_name": {
|
| 1079 |
"type": "string",
|
| 1080 |
+
"description": "The user's full_name provided by him/her, e.g. Alex Simon, Sarah Mary",
|
| 1081 |
},
|
| 1082 |
"contact_number": {
|
| 1083 |
"type": "string",
|
|
|
|
| 1104 |
"description": "The user's reason provided by him/her for the booking enquiry",
|
| 1105 |
},
|
| 1106 |
},
|
| 1107 |
+
"required": ["full_name", "contact_number", "street_address", "landmark", "zip_code", "emirate", "reason"],
|
| 1108 |
},
|
| 1109 |
}
|
| 1110 |
]
|
|
|
|
| 1177 |
arguments_dict = json.loads(arguments_str)
|
| 1178 |
|
| 1179 |
function_response = book_enquiry(
|
| 1180 |
+
full_name=arguments_dict["full_name"],
|
| 1181 |
contact_number=arguments_dict["contact_number"],
|
| 1182 |
street_address=arguments_dict["street_address"],
|
| 1183 |
landmark=arguments_dict["landmark"],
|
|
|
|
| 1188 |
|
| 1189 |
print("FUNCTION_RESPONSE:", function_response)
|
| 1190 |
# print("ARGUMENTS VALUES:", arguments_dict["location"], arguments_dict["unit"])
|
| 1191 |
+
print(f"ARGUMENTS VALUES: Full_name: {arguments_dict['full_name']}, Contact Number: {arguments_dict['contact_number']}, Street Address: {arguments_dict['street_address']}, Landmark: {arguments_dict['landmark']}, Zip Code: {arguments_dict['zip_code']}, Emirate: {arguments_dict['emirate']}, Reason: {arguments_dict['reason']}")
|
| 1192 |
|
| 1193 |
# messages.append(comp)
|
| 1194 |
# messages.append({
|