Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import os
|
|
| 4 |
import json
|
| 5 |
from bardapi import Bard
|
| 6 |
|
| 7 |
-
|
| 8 |
|
| 9 |
|
| 10 |
|
|
@@ -23,10 +23,10 @@ def bardChat(data):
|
|
| 23 |
}
|
| 24 |
|
| 25 |
# Set the "__Secure-1PSID" cookie with the Bard API key
|
| 26 |
-
session.cookies.set("__Secure-1PSID",
|
| 27 |
|
| 28 |
# Create a Bard object with the session and a timeout of 30 seconds
|
| 29 |
-
bard = Bard(token=
|
| 30 |
answer = bard.get_answer(data)['content']
|
| 31 |
print(answer)
|
| 32 |
|
|
|
|
| 4 |
import json
|
| 5 |
from bardapi import Bard
|
| 6 |
|
| 7 |
+
bardKey = os.environ.get('_BARD_API_KEY')
|
| 8 |
|
| 9 |
|
| 10 |
|
|
|
|
| 23 |
}
|
| 24 |
|
| 25 |
# Set the "__Secure-1PSID" cookie with the Bard API key
|
| 26 |
+
session.cookies.set("__Secure-1PSID", barkKey)
|
| 27 |
|
| 28 |
# Create a Bard object with the session and a timeout of 30 seconds
|
| 29 |
+
bard = Bard(token=bardKey, session=session, timeout=30)
|
| 30 |
answer = bard.get_answer(data)['content']
|
| 31 |
print(answer)
|
| 32 |
|