|
| 1 | +# 🤖 AI Chat Bot with Google Gemini API |
| 2 | + |
| 3 | +Welcome to the **AI Chat Bot - Google Gemini** project! |
| 4 | +This Python program uses the Google Gemini API to extract text from images, its a terminal-based application with a short conversational user interface. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## 🚀 Key Features |
| 9 | + |
| 10 | +- **Conversational User Interface:** Engages the user with prompts for their name and an image URL. |
| 11 | +- **Dynamic Image Handling:** Automatically detects the image type (e.g., PNG, JPEG) from the URL, making it flexible for different image formats. |
| 12 | +- **Robust URL Fetching:** Includes error checking to ensure the provided URL is valid and the image can be downloaded successfully. |
| 13 | +- **AI-Powered Text Extraction:** Leverages the Google Gemini API to accurately perform Optical Character Recognition (OCR) on the image. |
| 14 | +- **Personalized Output:** Appends the user's name to the extracted text for a custom touch. |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## 🗝️ Requires a Google AI Studio API Key |
| 19 | + |
| 20 | +To use this project, you must have a valid [Google AI Studio API Key](https://aistudio.google.com/apikey). |
| 21 | +This key is required to authenticate requests to the Gemini API. |
| 22 | +Store your API key securely in a `.env` file as described below. |
| 23 | + |
| 24 | +### 🔑 How to Create a Google AI Studio API Key |
| 25 | + |
| 26 | +1. Go to [Google AI Studio API Keys](https://aistudio.google.com/apikey). |
| 27 | +2. Sign in with your Google account if prompted. |
| 28 | +3. Click the **"Create API Key"** button. |
| 29 | +4. Copy the generated API key. |
| 30 | +5. In your project folder, create a file named `.env` (if it doesn't exist). |
| 31 | +6. Add the following line to your `.env` file (replace with your actual key): |
| 32 | + ``` |
| 33 | + GOOGLE_API_KEY=your-google-api-key-here |
| 34 | + ``` |
| 35 | + **🙏IMPORTANT: Never share your API key publicly or commit it to version control.** |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +## 🛠️ How to Run |
| 40 | + |
| 41 | +1. **Clone the repository** |
| 42 | + |
| 43 | + ```bash |
| 44 | + git clone https://github.com/your-username/Python-Programs.git |
| 45 | + cd Python-Programs/ai-chat-bot-google-gemini |
| 46 | + ``` |
| 47 | + |
| 48 | +2. **Set up your environment variables** |
| 49 | + |
| 50 | + - Create a `.env` file in this folder with: |
| 51 | + ``` |
| 52 | + GOOGLE_API_KEY=your-google-api-key-here # Replace with your actual API key |
| 53 | + ``` |
| 54 | +
|
| 55 | +3. **Install dependencies** |
| 56 | +
|
| 57 | + ```bash |
| 58 | + pip install -r requirements.txt |
| 59 | + ``` |
| 60 | + |
| 61 | +4. **Run the program in your terminal** |
| 62 | + ```bash |
| 63 | + python main.py |
| 64 | + ``` |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +## 📂 Folder Structure |
| 69 | + |
| 70 | +``` |
| 71 | +ai-chat-bot-google-gemini/ |
| 72 | +│ |
| 73 | +├── main.py # Main Python script |
| 74 | +├── requirements.txt # Python dependencies |
| 75 | +├── .env # Environment variables (not tracked by git) |
| 76 | +└── README.md # This documentation |
| 77 | +``` |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## 📚 References |
| 82 | + |
| 83 | +- [Google Gemini API Documentation](https://ai.google.dev/) |
| 84 | +- [Google Generative AI Python SDK](https://github.com/google-gemini/generative-ai-python) |
| 85 | +- [Google AI Studio API Key](https://aistudio.google.com/apikey) |
| 86 | +- [Google AI Image Understanding](https://ai.google.dev/gemini-api/docs/image-understanding) |
| 87 | +- [python-dotenv Documentation](https://pypi.org/project/python-dotenv/) |
| 88 | +- [requests Documentation](https://docs.python-requests.org/) |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +## 🙏 Acknowledgements |
| 93 | + |
| 94 | +This project was created for educational purposes and as a demonstration of integrating Google Gemini's API with Python as an assignment for the CIDM 4310/5310 Business Intelligence and Decision Support Systems course at West Texas A&M University, under the guidance of Dr. Cheng (Carl) Zhang. |
| 95 | + |
| 96 | +Special thanks to the open-source community and the authors of the libraries used! |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## 📝 License |
| 101 | + |
| 102 | +This project is for educational and demonstration purposes only. |
0 commit comments