Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,26 +16,39 @@ palm.configure(api_key=os.environ['PALM_KEY'])
|
|
| 16 |
|
| 17 |
def responsenew(data):
|
| 18 |
print(data)
|
| 19 |
-
response = palm.chat(messages=data
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
"message": "Slide left or right profiles or tap on 'My Friends' to view list of your friends: ",
|
| 30 |
-
"action": "show_friends",
|
| 31 |
-
"function": "nothing"
|
| 32 |
-
}
|
| 33 |
-
else:
|
| 34 |
-
respo = {
|
| 35 |
"message": response.last,
|
| 36 |
"action": "nothing",
|
| 37 |
"function": "nothing"
|
| 38 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
return json.dumps(respo)
|
| 40 |
|
| 41 |
gradio_interface = gr.Interface(
|
|
|
|
| 16 |
|
| 17 |
def responsenew(data):
|
| 18 |
print(data)
|
| 19 |
+
response = palm.chat(messages=f"""From the text given as data below by the user, find out what intention or category does the data fall under out of given 5 intents i.e:\n
|
| 20 |
+
1. purchasing coins\n
|
| 21 |
+
2. viewing friends list\n
|
| 22 |
+
3. viewing groups been joined by the user\n
|
| 23 |
+
4. viewing pages been joined by the user\n
|
| 24 |
+
5. user is saying to view the reminders been shared to the user or by the user\n
|
| 25 |
+
|
| 26 |
+
data = {data["text"]}""")
|
| 27 |
+
|
| 28 |
+
respo = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
"message": response.last,
|
| 30 |
"action": "nothing",
|
| 31 |
"function": "nothing"
|
| 32 |
}
|
| 33 |
+
# user_intent = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
| 34 |
+
# if "payment" in response.last:
|
| 35 |
+
# respo = {
|
| 36 |
+
# "message": "Click the button below to view Premium Services and Coin Recharge options: ",
|
| 37 |
+
# "action": "payment",
|
| 38 |
+
# "function": "nothing"
|
| 39 |
+
# }
|
| 40 |
+
# elif "friends" in response.last:
|
| 41 |
+
# respo = {
|
| 42 |
+
# "message": "Slide left or right profiles or tap on 'My Friends' to view list of your friends: ",
|
| 43 |
+
# "action": "show_friends",
|
| 44 |
+
# "function": "nothing"
|
| 45 |
+
# }
|
| 46 |
+
# else:
|
| 47 |
+
# respo = {
|
| 48 |
+
# "message": response.last,
|
| 49 |
+
# "action": "nothing",
|
| 50 |
+
# "function": "nothing"
|
| 51 |
+
# }
|
| 52 |
return json.dumps(respo)
|
| 53 |
|
| 54 |
gradio_interface = gr.Interface(
|