Last Updated on May 18, 2023 by mishou
I. Finding the value of the __Secure-1PSID Cookies of your Google Bard Account
You can learn how to find your API Key from the tutorial linked below:
Access Google Bard Easily with Python Package Bard-API
https://github.com/dsdanielpark/Bard-API
II. How to access Bard AI in Python
!pip install bardap
from bardapi import Bard
import os
os.environ['_BARD_API_KEY']="Your_VALUE_OF_THE _SEECURE-1PSID"
# set your input text
input_text = "Show sample code to create DataFrame with column names, 'Names'and 'Math'and 'English using Polars."
response0 = Bard().get_answer(input_text)['content']
print(response0)
If you want to ask something about “response0” above, you can use f-stings. Run such code as below:
# set your input text
input_text = f'"Show the code to change the column tiles of df in {response0}"'
response1 = Bard().get_answer(input_text)['content']
print(response1)
