Help with Image Generation using Gemini API and Base64 (Extension KIO4_Base64)

Hello everyone!

I am developing an AI assistant app called Clyborg. Previously, I had an issue with dictionary parsing for text responses, and thanks to this community, I solved it (here is the link to my previous post

Now, I am trying to take the next step: Image Generation.

My app uses the Gemini API to send a prompt. I want the AI to return an image of "Clyborg" (my character) based on the user's input. Since Gemini returns a JSON response, I am trying to extract the Base64 string and convert it into a file using the KIO4_Base64 extension to display it in an Image component.

The problem: Currently, nothing is happening. The image doesn't load, or the file is not being created correctly. I suspect it could be the way I'm asking Gemini for the Base64 (the prompt) or how I am handling the file path within the extension

Do you get a reasonable result in the GotText event?

Also what is the result in the GotFile event?
Remember how to debug in App Inventor...

Alternatively try

Taifun

I checked the post you sent me and tried to follow those steps. Am I on the right track or is there something else I should be doing? haha

Are you sure you understand what you are doing?

Assuming you get a reasonable result in the Web GofText event, you would use method SetInageFromBase64 there together with your base64 string

You forgot to answer

Taifun

This might help explain the values required.

Uses this base64 extension:

Note that the base64 string is just that, there is no datauri prefix.