Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/austenstone/openai-image-generation

Generate images using OpenAI Image Generation API DALLE
https://github.com/austenstone/openai-image-generation

actions dall-e image-generation openai

Last synced: 26 days ago
JSON representation

Generate images using OpenAI Image Generation API DALLE

Awesome Lists containing this project

README

        

# OpenAI Image Generation Action

This action generates an image using the [OpenAI Image Generation API](https://platform.openai.com/docs/guides/images/image-generation-beta).

## Usage
Create a workflow (eg: `.github/workflows/generate-image.yml`). See [Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file).

#### Example
```yml
name: Image Generation
on:
issue_comment:
types: [created]

jobs:
run:
if: ${{ startsWith(github.event.comment.body, '/image') }}
name: Run Action
runs-on: ubuntu-latest
steps:
- id: prompt
uses: actions/github-script@v3
with:
script: return context.payload.comment.body.replace('/image', '').trim()
- id: generate-image
uses: austenstone/openai-image-generation@main
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
prompt: ${{ steps.prompt.outputs.result }}
- run: gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments -f body="![image](${{ steps.generate-image.outputs.image }})"
env:
GH_TOKEN: ${{ github.token }}
```

## ➡️ Inputs
Various inputs are defined in [`action.yml`](action.yml):

| Name | Description | Default |
| --- | - | - |
| openai‑api‑key | OpenAI API key. | |
| prompt | Prompt to use for image generation. | |
| size | Size of the image to generate. | 512x512 |

## Further help
To get more help on the Actions see [documentation](https://docs.github.com/en/actions).