Giter VIP home page Giter VIP logo

openai-image-generator's Introduction

OpenAI Image Generator

A Node.js Express application for generating images using OpenAI's GPT-3 model.

Requirements

  • Node.js v12.0 or higher
  • npm v6.0 or higher
  • OpenAI API key

Installation

  1. Clone this repository: git clone https://github.com/ramyatrouny/openAI-image-generator
  2. Navigate to the cloned directory: cd openAI-image-generator
  3. Install dependencies: npm install
  4. Create a file called .env and add your OpenAI API key to it in the following format: OPENAI_API_KEY=[YOUR_API_KEY]
  5. Start the server: npm start

Usage

To generate an image, make a POST request to the openai/image endpoint with the desired image prompt in the request body. The server will return a JSON object containing the generated image.

Example:

curl -X POST \
  http://localhost:3000/generate \
  -H 'Content-Type: application/json' \
  -d '{
  "prompt": "A beautiful sunset over a lake",
  "size": "medium"
}'

The response will be a JSON object like the following:

{
    "success": true,
    "data": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-AeqKACJ0pkStTgufyZDU7TZU/user-YIY5cghm2QXQjgV1Xpju78In/img-hRjaqoX8aefiqq97z0vW5pVy.png?st=2022-12-07T08%3A30%3A01Z&se=2022-12-07T10%3A30%3A01Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2022-12-07T07%3A23%3A54Z&ske=2022-12-08T07%3A23%3A54Z&sks=b&skv=2021-08-06&sig=jVgpwM3ykQOS75BftkZ6P4ICJ8pI8d0HCBvNXkeKtDw%3D"
}

License

This project is licensed under the MIT License. See LICENSE for more information.

openai-image-generator's People

Contributors

ramyatrouny avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.