Skip to content

GeminiAI TextGen Explorer is an innovative project designed to showcase the potential of Google's Gemini 2.0 Flash Exp Generative AI model. This tool enables users to generate intelligent, context-aware textual content based on simple prompts, making it a valuable resource for developers, researchers, and content creators.

License

Notifications You must be signed in to change notification settings

muhdasif1/GeminiAI-TextGen-Explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

GeminiAI-TextGen-Explorer

GeminiAI TextGen Explorer is a beginner-friendly and practical project built using Python and Google Colab. It demonstrates how to use Google's Gemini 2.0 Flash Exp generative AI model to create smart, context-aware text content from simple prompts.

This project is great for:

  • Developers who want to explore text generation with minimal setup.
  • Researchers experimenting with natural language generation (NLG).
  • Content creators looking for creative writing assistance.

🔍 What is it?

GeminiAI TextGen Explorer connects your Colab notebook to Google’s Generative AI API, specifically using the model named "gemini-2.0-flash-exp". With just a few lines of code, you can input a prompt and get back detailed, high-quality AI-generated text.


✨ Key Features

  • Simple Setup: Just install one package and you’re ready to go!
  • Real-time Text Generation: Send prompts and get instant responses from Gemini AI.
  • Secure API Handling: Uses Colab’s userdata feature to manage your API key safely.
  • Beginner-Friendly: Step-by-step explanations included directly in the notebook.
  • Extensible: Easily modify the code for your own projects like chatbots, writing tools, or educational apps.

⚙️ How It Works (In Simple Steps)

  1. Install the Library
    We install the google-generativeai Python package which contains tools to interact with Gemini models.

    !pip install -q -U google-generativeai
  2. Import Required Modules

    import google.generativeai as genai
    from google.colab import userdata
  3. Load API Key Securely
    Using Colab’s userdata for private key storage:

    GOOGLE_API_KEY = userdata.get('GOOGLE_API_KEY')
  4. Configure the Gemini Library

    genai.configure(api_key=GOOGLE_API_KEY)
  5. Select and Load the AI Model

    model = genai.GenerativeModel("gemini-2.0-flash-exp")
  6. Send a Prompt and Get a Response

    response = model.generate_content("Your question or prompt here")
    print(response.text)

🧪 Example Output

Prompt: "imran khan"

Generated Response (summary):

Imran Khan is a former cricketer and politician who served as the Prime Minister of Pakistan from 2018 to 2022. He led Pakistan to its only Cricket World Cup win in 1992, founded PTI in 1996, and has been a key figure in Pakistani politics ever since...

(See the notebook for full output and detailed explanation.)

📘 Colab Notebook (View Only)
Explore the GeminiAI TextGen Explorer notebook here:
📎 Open in Google Colab


🔐 API Key Note

To run this notebook, you need a Google Generative AI API key. In Google Colab, store it like this:

from google.colab import userdata
GOOGLE_API_KEY = userdata.get("GOOGLE_API_KEY")

You can generate your API key by signing up for Google AI Studio or Developer Console (check Google’s documentation for the latest instructions).


🚀 Use Cases

  • Creative Writing
  • Research Summaries
  • Chatbot Prototypes
  • Educational Tools
  • Text-based Games

👤 Author

Muhammad Asif – 🔗 Connect on LinkedIn


About

GeminiAI TextGen Explorer is an innovative project designed to showcase the potential of Google's Gemini 2.0 Flash Exp Generative AI model. This tool enables users to generate intelligent, context-aware textual content based on simple prompts, making it a valuable resource for developers, researchers, and content creators.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published