Chat AI & Image Generator (aka Synthi)

Synthi Chat AI & Image Generator (work in progress)

Overview

Thanks to @ioannisroungeris/@ioannis posting this a month ago, I started my deep dive into AI’s chat and image generator features.

I’ve put a lot of time into this project – before Thunkable added blocks to help with all this – and had to learn a lot about chat parameters, image generator prompts, and text-to-speech.

I’m calling it Synthi for now. So what does it do? It’s a conversational chat bot and image generator with a magic prompt option.

Features

Chat bot: Conversational, connects ideas from previous responses; can answer questions, tell jokes, summarize long texts, write essays, create code, etc. It uses Google Cloud Text-to-Speech for natural-sounding voice responses.
(Ooh, is this ChatGPT? Nope but it’s close… it uses OpenAI’s text-davinci-003 API) Yes, it’s now using the GPT-4 API as of 3/17/23.

Image generator: Enter a description of an image and it will create two never seen before images from it
(It uses DALL-E which is not as impressive as Stable Diffusion or MidJourney but this next feature helps…)

• Added Stable Diffusion image generator 1/19/23

Magic prompt generator: You can enter a brief description such as “A stunning photo of the Eiffel tower at night with lights shining” and the app will return several enhanced prompts such as “A stunning photo of the Eiffel tower at night with lights shining on it, in the style of Caspar David stunning photo of the Eiffel tower at night with lights shining on it, award-winning.” You can choose any of those prompts to then generate additional images.

Share images: Generated images can be exported as email or text message, or saved to photo album.

Negative prompt: You can enter text to exclude from a generated image.

DEMO button: You can tap the DEMO button to see a sample AI-generated image. This might be helpful for someone who doesn’t have any experience with AI image generation and just wants to see an example of how it works.

I unfortunately can’t share the project because I’m quickly reaching my quota for image generation without paying for the service. And because I’ve put a bunch of hours into it! But here is a video where I show how it works:

Screenshots

Text Chat & DALL-E Image Generation

Stable Diffusion & Negative Prompt

DEMO button

Video

Note: this video was made with the first version of Synthi and does not include the updates posted later in this topic.

6 Likes

pretty impressive demo!

Thanks for sharing this :slight_smile:
do you know if it is possible to use Stable Diffusion API inside of thinkable using the advanced web API feature?
I’ve tried but have had no success

I love Stable Diffusion and it’s much better than DALL-E. I haven’t tried to get their API to work in Thunkable. What have you tried?

This looks promising: https://api.stability.ai/docs#tag/v1alphageneration/operation/v1alpha/generation#textToImage

1 Like

Thanks for replying !
I actually tried everything that’s possible ( even dumb solutions include using Initialize app variable API key and using it with the advanced API function) but didn’t get it to work I would love to search more and I’ll look into the link you’ve provided, if i can find anything I’ll update you here :slight_smile:

This curl command works for me so it’s just a matter of converting that to Thunkable blocks (which arguably is the hard part!):

curl -f -sS --request POST “https://api.stability.ai/v1alpha/generation/stable-diffusion-512-v2-0/text-to-image” -H ‘Content-Type: application/json’ -H ‘Accept: image/png’ -H “Authorization: [INSERT_API_KEY]” --data-raw ‘{“cfg_scale”: 7,“clip_guidance_preset”: “FAST_BLUE”,“height”: 512,“width”: 512,“samples”: 1,“steps”: 50,“text_prompts”: [{“text”: “A lighthouse on a cliff”,“weight”: 1}]}’ -o ~/Downloads/output.png

Thank you that’s an amazing help for me!
Are there any projects or videos you came across before that did something similar in terms of converting the command into blocks?

Thanks again.

It’s a lot of trial and error. It usually takes me a couple hours to figure out conversions from Curl to Thunkable.

1 Like

@tatiang Excellent project! You did a fantastic job.

2 Likes

An update :slight_smile:
i’ve tried the body row code in postman and it worked perfectly however when I tried to set the code in thunkable it didn’t work for some reason

The blocks I’ve used
can you tell if there is something wrong ?

My favorite thing about @tatiang’s Chat Bot is that even it cannot clearly explain offsides in football. :joy: :soccer:

1 Like

Nobody can! :crazy_face:

I think that’s probably the ultimate turing test. :wink:

1 Like

The Stable Diffusion API requires authorization headers. You can’t use it without an API key.

i have tried it with an API authorization header but still the same problem :frowning:
444444

That looks right. But you also need the Accept header. If it still doesn’t work:

  1. What’s the error message you’re seeing?
  2. Double-check your API key. I thought I had copied and pasted it but somehow missed the first few characters.

yes it took me hours of trying but nothing at the end
The error message on the web is ( NetworkError when attempting to fetch resource.)
so I’m exporting the apk file and testing it and I don’t get any error message when doing so
I’ve tried the accept header as well and Double checked the API but no results

That’s frustrating! I’ve also spent hours… this is not easy stuff.

I noticed your endpoint is different than mine. I’m using this one which is also part of the curl command above:

https://api.stability.ai/v1alpha/generation/stable-diffusion-512-v2-0/text-to-image

Thanks for everything you’ve shared
and yes I’ve tried your endpoint at first with the same inputs and also different but I switched later to
https://stablediffusionapi.com/api/v3/text2img

I guess I have to post it to the community maybe we can get it to work somehow!

Update: added Stable Diffusion image generator (see robot guardian image in first post above)

I don’t think I can (easily) add a magic prompt for Stable Diffusion but it will be impressive if I can…

wow, that’s impressive!
good work, I hope I can add it soon also

1 Like