estevaofon / gpt-image-generator

Generates images using OpenAI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ‘Ύ About

This code is a Python script that uses the OpenAI API to generate an image based on a given text prompt. It imports necessary libraries, sets up the OpenAI API, creates a function "create_image" that takes in a string "description" as a prompt and returns an image URL. Finally, it runs the "create_image" function if the script is run directly and prints the resulting image URL.

πŸ”§ Requirements

The following Python libraries are required:

  • os
  • openai
  • sys
  • dotenv

πŸš€ OpenAI API

This application uses the OpenAI API. You will need to obtain an API key from the OpenAI website, and add it to your environment variables or a .env file in the project root with the key OPENAI_API_KEY.

:shipit: Environment Variables

This application uses the following environment variables, which need to be added to a .env file in the project root:

  • OPENAI_API_KEY

πŸƒ Usage

python filename.py "description"

πŸ™‹ Contribution

All contributions are welcome! Please open an issue or submit a pull request.

About

Generates images using OpenAI


Languages

Language:Python 100.0%