Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This readme file was automatically generated by ChatGPT.

中文

Generate Images Automatically

A project that uses koa framework and openai library to generate images automatically.

Project Description

The goal of this project is to use natural language processing technology to generate images automatically. We use the dall-e model from the openai library, which can generate corresponding images based on text descriptions. For example, when the user inputs "a cat sitting on a sofa", the system will automatically generate an image of a cat sitting on a sofa.

Features

  • Implemented a simple HTTP server using the koa framework to provide a RESTful API for image generation.
  • Provided a front-end page for users to input descriptions and generate images.
  • Used CSS and JavaScript animation effects to beautify the front-end page.

Installation and Usage

Installation

First, install the Node.js environment. Then, run the following command in the project root directory to install the dependencies:

npm install

Configuration

Before using the openai library, you need to register an account on the openai website and obtain an API key.

Enter the obtained API key in the server.js file:

const { Configuration, OpenAIApi } = require("openai");

const configuration = new Configuration({
apiKey: "your API key",
});
const openai = new OpenAIApi(configuration);

Running

Run the following command in the project root directory to start the project:

npm start

After the project starts, you can use the project by visiting http://localhost:3000 in a browser.

Example

Assuming that you have started the project and visited http://localhost:3000 in a browser, you will see a screen similar to the following:

自动生成图片示例

Enter "a cat sitting on a sofa" in the input box and click the "Generate Image" button. The page will display an image of a cat sitting on a sofa.

License

MIT License. For more information, see the LICENSE file.

About

A project that uses koa framework and openai library to generate images automatically.

Resources

Stars

12 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages