Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import google.generativeai as palm
|
|
| 2 |
import gradio as gr
|
| 3 |
import os
|
| 4 |
import json
|
|
|
|
| 5 |
|
| 6 |
# Set your API key
|
| 7 |
palm.configure(api_key=os.environ['PALM_KEY'])
|
|
@@ -9,18 +10,22 @@ palm.configure(api_key=os.environ['PALM_KEY'])
|
|
| 9 |
# Select the PaLM 2 model
|
| 10 |
# model = 'models/text-bison-001'
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
def responsenew(data):
|
| 14 |
response = palm.chat(messages=data)
|
|
|
|
| 15 |
if "payment" in response.last:
|
| 16 |
respo = {
|
| 17 |
-
"message": "Click the button below to view
|
| 18 |
"action": "payment",
|
| 19 |
"function": "nothing"
|
| 20 |
}
|
| 21 |
elif "friends" in response.last:
|
| 22 |
respo = {
|
| 23 |
-
"message": "
|
| 24 |
"action": "show_friends",
|
| 25 |
"function": "nothing"
|
| 26 |
}
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import os
|
| 4 |
import json
|
| 5 |
+
from transformers import pipeline
|
| 6 |
|
| 7 |
# Set your API key
|
| 8 |
palm.configure(api_key=os.environ['PALM_KEY'])
|
|
|
|
| 10 |
# Select the PaLM 2 model
|
| 11 |
# model = 'models/text-bison-001'
|
| 12 |
|
| 13 |
+
# candlab= ["recharge coins or get subscription", "show list of my friends"]
|
| 14 |
+
|
| 15 |
+
print(data["message"])
|
| 16 |
|
| 17 |
def responsenew(data):
|
| 18 |
response = palm.chat(messages=data)
|
| 19 |
+
# user_intent = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
| 20 |
if "payment" in response.last:
|
| 21 |
respo = {
|
| 22 |
+
"message": "Click the button below to view Premium Services and Coin Recharge options: ",
|
| 23 |
"action": "payment",
|
| 24 |
"function": "nothing"
|
| 25 |
}
|
| 26 |
elif "friends" in response.last:
|
| 27 |
respo = {
|
| 28 |
+
"message": "Slide left or right profiles or tap on 'My Friends' to view list of your friends: ",
|
| 29 |
"action": "show_friends",
|
| 30 |
"function": "nothing"
|
| 31 |
}
|