How to use Google bard for free ( with. Python )

2023. 6. 4. 19:16it

반응형

 

 

1. Install bard api

pip install bardapi

 

2. bard connection
We will use cookies instead of api keys.

 

2-1. Access from Google Board.

https://bard.google.com/?hl=en

 

반응형

 

 

2-2. developer mode ( Press F12 )

Copy the value of __Secure-1PSID.

 

728x90

 

 

3. Write a program in python

Enter _Secure-1PSID in token

 

import bardapi

token = '__Secure-1PSID'

INPUT_DATA = "hello? "

bard_answer = bardapi.core.Bard(token).get_answer(INPUT_DATA)

print( bard_answer['content'] )

 

3-1. result

 

 

user : hello?

bard_answer : Hello! How can I help you today?

 

 

4. Reference

Referenced pypi source : https://pypi.org/project/googlebardapi/

 

googlebardapi

The python package that returns Response of Google Bard through API.

pypi.org

 

반응형