This project uses OpenAI's GPT-4 Vision API and Puppeteer to generate images based on the content of a webpage.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
You need to have Node.js installed on your machine to run this project. You can download it from here.
-
Clone the repository:
git clone https://github.com/RaheesAhmed/img-gpt.git
-
Install the dependencies:
cd image-generation npm install
-
Create a
.env
file in the root directory of the project and add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key
-
Run the script:
node index.js
The script does the following:
- Launches a new Puppeteer browser.
- Opens a new page and navigates to "https://teletimesinternational.com/".
- Extracts the content of the page.
- Reads the content of two files: "IMGPT analytics.txt" and "IMGPT.txt", and combines them with the extracted content to create a prompt.
- If the content includes the phrase "important keyword", an additional prompt is added.
- Sends the prompt to the OpenAI API to generate images.
- Logs the generated images.
- Closes the browser.
- Puppeteer - Headless browser used for web scraping
- OpenAI - AI model used for image generation
- dotenv - Used to load environment variables
- fs - Node.js file system module for reading files
- Rahees Ahmed
This project is licensed under the MIT License - see the LICENSE.md file for details.
- OpenAI for their amazing GPT-4 Vision API
- Puppeteer for their powerful headless browser