Welcome to the AI Chat Bot - Google Gemini project!
This Python program uses the Google Gemini API to extract text from images, its a terminal-based application with a short conversational user interface.
- Conversational User Interface: Engages the user with prompts for their name and an image URL.
- Dynamic Image Handling: Automatically detects the image type (e.g., PNG, JPEG) from the URL, making it flexible for different image formats.
- Robust URL Fetching: Includes error checking to ensure the provided URL is valid and the image can be downloaded successfully.
- AI-Powered Text Extraction: Leverages the Google Gemini API to accurately perform Optical Character Recognition (OCR) on the image.
- Personalized Output: Appends the user's name to the extracted text for a custom touch.
To use this project, you must have a valid Google AI Studio API Key.
This key is required to authenticate requests to the Gemini API.
Store your API key securely in a .env file as described below.
- Go to Google AI Studio API Keys.
- Sign in with your Google account if prompted.
- Click the "Create API Key" button.
- Copy the generated API key.
- In your project folder, create a file named
.env(if it doesn't exist). - Add the following line to your
.envfile (replace with your actual key):🙏IMPORTANT: Never share your API key publicly or commit it to version control.GOOGLE_API_KEY=your-google-api-key-here
-
Clone the repository
git clone https://github.com/your-username/Python-Programs.git cd Python-Programs/ai-chat-bot-google-gemini -
Set up your environment variables
- Create a
.envfile in this folder with:GOOGLE_API_KEY=your-google-api-key-here # Replace with your actual API key
- Create a
-
Install dependencies
pip install -r requirements.txt
-
Run the program in your terminal
python main.py
ai-chat-bot-google-gemini/
│
├── main.py # Main Python script
├── requirements.txt # Python dependencies
├── .env # Environment variables (not tracked by git)
└── README.md # This documentation
- Google Gemini API Documentation
- Google Generative AI Python SDK
- Google AI Studio API Key
- Google AI Image Understanding
- python-dotenv Documentation
- requests Documentation
This project was created for educational purposes as a part of integrating Google Gemini's API with Python for the Computer Information and Decision Management Business Intelligence and Decision Support Systems course at West Texas A&M University, under the guidance of Dr. Cheng (Carl) Zhang.
Special thanks to the open-source community and the authors of the libraries used!
This project is for educational and demonstration purposes only.