0.2.2 • Published 4 months ago

wc-img-ai v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

AI based img-tags

By simply providing a src to an api that does the AI for you, and you can simply get ai-rendered images anywhere you need based on the prompt-attribute.

<ai-img
  src="http://localhost:4321/api/openai/img"
  width="256"
  height="256"
  prompt="funny dolphin up to no good"
  fallback="https://placekitten.com/200/300"
></ai-img>

installation

pnpm i wc-img-ai
<script type="module">
  import "wc-img-ai"
</script>

The api server itself needs to receive this body and return a string with the url of the image

Function: POST

The web-component sends a POST request to the API to generate an image and expects an image in return.

Request Body Format

  • prompt (string): The description or prompt based on which the image will be generated.
  • width (number): The width of the desired image in pixels.
  • height (number): The height of the desired image in pixels.

Example Request Body

{
  "prompt": "a sleeping little kitten",
  "width": 256,
  "height": 256
}

Server Return

it is expected to return a simple string

"https://example.com/path/to/generated/image.jpg"

Demo

Check it out running inside an MDX/Astro framework

0.1.0

4 months ago

0.2.1

4 months ago

0.1.2

4 months ago

0.2.0

4 months ago

0.1.1

4 months ago

0.2.2

4 months ago

0.0.6

4 months ago

0.0.5

4 months ago

0.0.4

4 months ago

0.0.3

4 months ago

0.0.2

4 months ago

0.0.1

4 months ago