Saturday, January 27, 2024

Gemini - Simple first app

To get API key, can go via makersuite: 

https://makersuite.google.com/app/apikey

The below code Sample can get you started 

import os

import google.generativeai as genai

os.environ['GOOGLE_API_KEY'] = "AIzaSyB5dyxjVRBu4Ee0Oopcp_s_wX5gGnjK6sg"

genai.configure(api_key = os.environ['GOOGLE_API_KEY'])

model = genai.GenerativeModel('gemini-pro')

response = model.generate_content("What are top 5 superfast cars in the world?")

print(response.text)

references:

https://codemaker2016.medium.com/build-your-own-chatgpt-using-google-gemini-api-1b079f6a8415#5f9f 


No comments:

Post a Comment