https://github.com/davutbayik/ai-product-image-generator
Automatically generate commercial-quality product mockup images using OpenAI and Google Workspace integrations (Sheets + Drive).
https://github.com/davutbayik/ai-product-image-generator
agents ai google-cloud-platform google-drive-api google-sheets-api gpt-4 gpt-image-1 image-generation-ai image-generator-using-openai-api openai product-generator python text-to-image
Last synced: about 1 month ago
JSON representation
Automatically generate commercial-quality product mockup images using OpenAI and Google Workspace integrations (Sheets + Drive).
- Host: GitHub
- URL: https://github.com/davutbayik/ai-product-image-generator
- Owner: davutbayik
- License: mit
- Created: 2025-06-02T15:12:16.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-06-02T22:48:44.000Z (about 1 year ago)
- Last Synced: 2025-07-03T11:42:43.247Z (11 months ago)
- Topics: agents, ai, google-cloud-platform, google-drive-api, google-sheets-api, gpt-4, gpt-image-1, image-generation-ai, image-generator-using-openai-api, openai, product-generator, python, text-to-image
- Language: Python
- Homepage:
- Size: 30.9 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ποΈ AI-Powered Product Mockup Generator
[](LICENSE)


Automatically generate commercial-quality product mockup images using OpenAI and Google Workspace integrations (Sheets + Drive).
---
## β¨ Features
* π Reads product data from a Google Sheet
* π§ Uses GPT-4 to generate visual mockup prompts
* π¨ Generates product images using OpenAI image API
* πΎ Saves generated mockups to a local folder
* βοΈ Uploads images to a specific Google Drive folder
* β
Updates the status of each processed product in the original Google Sheet
* π Logs all processing steps and errors
## π Folder Structure
```
project/
βββ output/ # Saved mockup images
βββ .env # Environment file with OpenAI API key
βββ YOUR-GOOGLE-CLOUD-SERVICE-AUTH-JSON
βββ process_logs.log # Log file
βββ main.py # Main script (provided above)
```
## π₯ Example Demo
https://github.com/user-attachments/assets/54a42888-9920-4340-a46d-ebe20cf9f960
## π οΈ Installation
1. Clone the repository:
```bash
git clone https://github.com/davutbayik/ai-product-image-generator.git
cd ai-product-image-generator
2. Create and activate a virtual environment (Optional-Recommended):
```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
3. Install the required packages:
```bash
pip install -r requirements.txt
4. Set Up `.env`:
Create a `.env` file with your OpenAI API key:
```ini
OPENAI_API_KEY=sk-xxxxxxx
```
5. Set Up Google Cloud Credentials:
* Go to [Google Cloud Console](https://console.cloud.google.com/)
* Enable **Google Sheets API** and **Google Drive API**
* Create a service account and download the JSON key
* Share your **Google Sheet** and **Google Drive Folder** with the service account email
6. Add Folder and Sheet IDs:
Update this part in your code:
```python
DRIVE_FOLDER_ID = "your-google-drive-folder-id"
GOOGLE_SHEETS_ID = "your-google-sheets-id"
```
7. Run the Script:
```bash
python main.py
```
## π§ͺ Example Sheet Structure
| ID | Description | Category | Color | Material | Additional Notes | Status |
| ---- | ------------------------------------------ | ------------- | ----------- | ------------------- | -------------------------- | ------- |
| 1001 | Silicone baby feeding set with bowl, spoon | Baby Products | Pastel Blue | Food-grade silicone | Suction base, toddler safe | Pending |
> The script will only process rows with `Status = Pending`
## π οΈ Prompt Logic (GPT System Prompt)
* Understands fields like `Description`, `Category`, `Color`, `Material`, and `Additional Notes`
* Generates clean, realistic mockup prompts for DALLΒ·E / OpenAI Image API or other image generation APIs
## π Security
* Do not upload your `.env` or service account JSON to any public repository
## π‘ Future Improvements
* Add UI with Streamlit for manual input or preview
* Enable batch download of all generated images
* Add error reporting via email or Slack
## π License
This project is licensed under the terms of the [MIT License](LICENSE).
You are free to use, modify, and distribute this software as long as you include the original license.
## π¬ Contact
Made with β€οΈ by [Davut BayΔ±k](https://github.com/davutbayik) β feel free to reach out via GitHub for questions, feedback, or collaboration ideas.
---
β If you found this project helpful, consider giving it a star!