Spaces:
Runtime error
Runtime error
this
Browse files
app.py
CHANGED
|
@@ -45,7 +45,7 @@ def responsenew(data):
|
|
| 45 |
- You can start a timer or a stopwatch\n
|
| 46 |
|
| 47 |
|
| 48 |
-
Identify the user's intent from the given text data
|
| 49 |
|
| 50 |
Args:\n
|
| 51 |
text_data: {data}.\n\n
|
|
@@ -57,7 +57,6 @@ def responsenew(data):
|
|
| 57 |
* if intent = viewing communities joined return = "view_communities"
|
| 58 |
* if intent = viewing shared reminders return = "shared_reminders"
|
| 59 |
* if intent = viewing user's routines return = "my_routines"
|
| 60 |
-
* if intent = nothing return = "nothing"
|
| 61 |
* if intent = viewing all the groups existing on CosmoAI return = "view_all_groups"
|
| 62 |
* if intent = viewing all the communities existing on CosmoAI return = "view_all_communities"
|
| 63 |
* if intent = viewing user's notes return = "view_notes"
|
|
@@ -74,64 +73,71 @@ def responsenew(data):
|
|
| 74 |
* if intent = creating a note return = "create_note"
|
| 75 |
* if intent = creating a post return = "create_post"
|
| 76 |
* if intent = creating a todo list return = "create_todo_list"
|
| 77 |
-
* if intent
|
| 78 |
-
* if intent
|
| 79 |
-
* if intent
|
| 80 |
* if intent = sharing a todo list return = "share_todo_list"
|
| 81 |
* if intent = sharing a note return = "share_note"
|
|
|
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
""")
|
| 86 |
print(intent)
|
| 87 |
-
respo = {
|
| 88 |
-
|
| 89 |
-
"action": "nothing",
|
| 90 |
-
"function": "nothing"
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
# if "recoin" in intent.last:
|
| 94 |
-
# respo = {
|
| 95 |
-
# "message": "Click the button below to view Premium Services and Coin Recharge options: ",
|
| 96 |
-
# "action": "payment",
|
| 97 |
-
# "function": "nothing"
|
| 98 |
-
# }
|
| 99 |
-
# elif "view_friends" in intent.last:
|
| 100 |
-
# respo = {
|
| 101 |
-
# "message": "Here's the list of your friends: ",
|
| 102 |
-
# "action": "show_friends",
|
| 103 |
-
# "function": "nothing"
|
| 104 |
-
# }
|
| 105 |
-
# elif "view_groups" in intent.last:
|
| 106 |
-
# respo = {
|
| 107 |
-
# "message": "You are member of following groups: ",
|
| 108 |
-
# "action": "show_mygroups",
|
| 109 |
-
# "function": "nothing"
|
| 110 |
-
# }
|
| 111 |
-
# elif "view_pages" in intent.last:
|
| 112 |
-
# respo = {
|
| 113 |
-
# "message": "You are part of following communities🫶: ",
|
| 114 |
-
# "action": "show_mycommunities",
|
| 115 |
-
# "function": "nothing"
|
| 116 |
-
# }
|
| 117 |
-
# elif "sharedrem" in intent.last:
|
| 118 |
-
# respo = {
|
| 119 |
-
# "message": "Here's the list of your shared reminders: ",
|
| 120 |
-
# "action": "shared_reminders",
|
| 121 |
-
# "function": "nothing"
|
| 122 |
-
# }
|
| 123 |
-
# elif "myroutines" in intent.last:
|
| 124 |
-
# respo = {
|
| 125 |
-
# "message": "Here's the list of your routines: ",
|
| 126 |
-
# "action": "myroutines",
|
| 127 |
-
# "function": "nothing"
|
| 128 |
-
# }
|
| 129 |
-
# else:
|
| 130 |
-
# respo = {
|
| 131 |
-
# "message": response.last,
|
| 132 |
# "action": "nothing",
|
| 133 |
# "function": "nothing"
|
| 134 |
# }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
return json.dumps(respo)
|
| 136 |
|
| 137 |
gradio_interface = gr.Interface(
|
|
|
|
| 45 |
- You can start a timer or a stopwatch\n
|
| 46 |
|
| 47 |
|
| 48 |
+
Identify the user's intent from the given text data.\n
|
| 49 |
|
| 50 |
Args:\n
|
| 51 |
text_data: {data}.\n\n
|
|
|
|
| 57 |
* if intent = viewing communities joined return = "view_communities"
|
| 58 |
* if intent = viewing shared reminders return = "shared_reminders"
|
| 59 |
* if intent = viewing user's routines return = "my_routines"
|
|
|
|
| 60 |
* if intent = viewing all the groups existing on CosmoAI return = "view_all_groups"
|
| 61 |
* if intent = viewing all the communities existing on CosmoAI return = "view_all_communities"
|
| 62 |
* if intent = viewing user's notes return = "view_notes"
|
|
|
|
| 73 |
* if intent = creating a note return = "create_note"
|
| 74 |
* if intent = creating a post return = "create_post"
|
| 75 |
* if intent = creating a todo list return = "create_todo_list"
|
| 76 |
+
* if intent = sharing a reminder return = "share_reminder"
|
| 77 |
+
* if intent = sharing a routine return = "share_routine"
|
| 78 |
+
* if intent = sharing a group return = "share_group"
|
| 79 |
* if intent = sharing a todo list return = "share_todo_list"
|
| 80 |
* if intent = sharing a note return = "share_note"
|
| 81 |
+
* if intent = knowing your name or who you are or what is your name kind of question by user return = "cosmo_name"
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
""")
|
| 86 |
print(intent)
|
| 87 |
+
# respo = {
|
| 88 |
+
# "message": intent.last,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
# "action": "nothing",
|
| 90 |
# "function": "nothing"
|
| 91 |
# }
|
| 92 |
+
|
| 93 |
+
if "purchase_coins" in intent.last:
|
| 94 |
+
respo = {
|
| 95 |
+
"message": "Click the button below to view Premium Services and Coin Recharge options: ",
|
| 96 |
+
"action": "payment",
|
| 97 |
+
"function": "nothing"
|
| 98 |
+
}
|
| 99 |
+
elif "view_friends" in intent.last:
|
| 100 |
+
respo = {
|
| 101 |
+
"message": "Here's the list of your friends: ",
|
| 102 |
+
"action": "show_friends",
|
| 103 |
+
"function": "nothing"
|
| 104 |
+
}
|
| 105 |
+
elif "view_groups" in intent.last:
|
| 106 |
+
respo = {
|
| 107 |
+
"message": "You are member of following groups: ",
|
| 108 |
+
"action": "show_mygroups",
|
| 109 |
+
"function": "nothing"
|
| 110 |
+
}
|
| 111 |
+
elif "view_communities" in intent.last:
|
| 112 |
+
respo = {
|
| 113 |
+
"message": "You are part of following communities🫶: ",
|
| 114 |
+
"action": "show_mycommunities",
|
| 115 |
+
"function": "nothing"
|
| 116 |
+
}
|
| 117 |
+
elif "shared_reminders" in intent.last:
|
| 118 |
+
respo = {
|
| 119 |
+
"message": "Here's the list of your shared reminders: ",
|
| 120 |
+
"action": "shared_reminders",
|
| 121 |
+
"function": "nothing"
|
| 122 |
+
}
|
| 123 |
+
elif "my_routines" in intent.last:
|
| 124 |
+
respo = {
|
| 125 |
+
"message": "Here's the list of your routines: ",
|
| 126 |
+
"action": "myroutines",
|
| 127 |
+
"function": "nothing"
|
| 128 |
+
}
|
| 129 |
+
elif "cosmo_name" in intent.last:
|
| 130 |
+
respo = {
|
| 131 |
+
"message": "My name is Cosmo. I am your friendly personal assistant.",
|
| 132 |
+
"action": "nothing",
|
| 133 |
+
"function": "nothing"
|
| 134 |
+
}
|
| 135 |
+
else:
|
| 136 |
+
respo = {
|
| 137 |
+
"message": response.last,
|
| 138 |
+
"action": "nothing",
|
| 139 |
+
"function": "nothing"
|
| 140 |
+
}
|
| 141 |
return json.dumps(respo)
|
| 142 |
|
| 143 |
gradio_interface = gr.Interface(
|