Botnoi Voice

Dec 29, 2022

Label

UX/UI

Describe the picture you want in LINE and let AI create it for you.

Describe the picture you want in LINE and let AI create it for you.

Recently, there has been a significant buzz around AI's capability to generate images. This excitement follows the launch of several AI models from various companies, including OpenAI, which launched DALL-E, an AI for image generation.

Using the OpenAI website to create images is very user-friendly, especially for developers. It's certainly convenient and easy enough to create images directly on their website, but OpenAI also provides an API service that allows developers to integrate this functionality into other platforms.

Integrating this service into a LINE chatbot would make it even more accessible, especially for international users who might be uncomfortable navigating English websites. With this integration, you can easily harness the magic of AI image generation right from your everyday messaging app. From children to seniors, anyone can easily let their imagination run wild! You can try out a sample LINE chatbot by adding it via this link: LINE chatbot.

Example of Using the Chatbot

example-using-chatbot

For chatbot developers looking to expand their skills, this article will guide them on creating a more advanced chatbot. The process involves three steps and can be done in under 30 minutes. Let’s start your timer!

Step 1: Get an OpenAI API Key

a. Go to OpenAI's website https://openai.com/

b. Sign up and log in.

c. Click on "Personal" in the top right corner and select "View API keys."

how-to-view-api-key

d. Generate a new API key and make sure to save it. Note that the system will not show the key again.

how-to-generate-api-key

I've created a tutorial video on how to obtain the token for your convenience:

Step 2: Create an API Object in BOTNOI

a. Review OpenAI's API usage document https://beta.openai.com/docs/guides/images/usage

curl https://api.openai.com/v1/images/generations \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"prompt": "a white siamese cat",
"n": 1,
"size": "1024x1024"
}'

b. Create the API Object in BOTNOI https://botnoi.ai

how-to-create-api-object

Step 3: Build the Chatbot Flow

a. Define the intents and train them accordingly.

how-to-define-intents

b. Create Responses:

  • Configure the response to call the API object.

  • Store the API result in a variable called `<<res_image>>`.

  • Create a custom payload for the LINE image object.

how-to-create-the-response
  • Develop the custom payload to display the image in LINE.

    code-to-display-image-in-line


For those who haven't used BOTNOI before, here's a helpful playlist to get you started.

What’s Next? More AI Fun!

Aside from AI that can help you generate pictures, there’s another AI tool causing a stir called ChatGPT, which generates text. Imagine combining it with LINE, there’s so much you could do. Stay tuned, as we’ll explore that in the next article.

Join the Creative AI Community

And last but not least, if you are as passionate about AI and art as I am, check out our new community Prompt Engineer. Here you can share creative ways to use AI in art. Whether you are just curious or already experimenting with AI, come join us and get inspired.

Join the Prompt Engineers Community: https://www.facebook.com/promptengineers

กลับ

Collaborate to Innovate

Together, We Build the Future.

Collaborate to Innovate

Together, We Build the Future.