This repository provides a simple example of how to use the Google Gemini API for content generation using Python. The notebook demonstrates how to configure the API, select a model, and generate text-based content based on a given prompt.
- Python 3.7 or higher
- Google Generative AI Python SDK
To install the required packages, you can use pip:
pip install -q -U google-generativeai
- Clone this repository:
git clone https://github.com/yourusername/gemini-ai-content.git
- Navigate to the project directory:
cd gemini-ai-content
-
Open the Jupyter Notebook (
gemini_ai_content_generation.ipynb
) and replace"GEMINI_API_KEY_HERE"
with your actual Google Gemini API key. -
Run the notebook cells to generate content using the AI model.
Below is a simple example of how the code works:
import google.generativeai as genai
genai.configure(api_key="GEMINI_API_KEY_HERE")
model = genai.GenerativeModel('gemini-pro')
response = model.generate_content(
"""
Explain how AI works.
"""
)
print(response.text)
Feel free to submit issues or pull requests if you have any improvements or suggestions.
This project is licensed under the MIT License. See the LICENSE file for more details.