Download app.py from rajkumar218/firstmodel: direct link, hf CLI and curl.
- Browser
- Download file 661 Bytes
-
https://huggingface.co/rajkumar218/firstmodel/resolve/main/app.py
- Command line
-
hf download hf://rajkumar218/firstmodel/app.py
-
curl -L -o app.py https://huggingface.co/rajkumar218/firstmodel/resolve/main/app.py
661 Bytes
| """ | |
| At the command line, only need to run once to install the package via pip: | |
| $ pip install google-generativeai | |
| """ | |
| import os | |
| from dotenv import load_dotenv, find_dotenv | |
| load_dotenv(find_dotenv()) | |
| import google.generativeai as palm | |
| palm.configure(api_key=os.environ["PALM_API_KEY"]) | |
| defaults = { | |
| 'model': 'models/chat-bison-001', | |
| 'temperature': 0.25, | |
| 'candidate_count': 1, | |
| 'top_k': 40, | |
| 'top_p': 0.95, | |
| } | |
| context = "" | |
| examples = [] | |
| messages = [] | |
| messages.append("what is 1 + 3 ?") | |
| response = palm.chat( | |
| **defaults, | |
| context=context, | |
| examples=examples, | |
| messages=messages | |
| ) | |
| print(response.last) # Response of the AI to your most recent request |