Skip to content

AI and maps

Add image understanding and text-to-speech

Div-idy documentation Updated

Div-idy supports AI image understanding and text-to-speech in generated React apps. Visitors can choose an image and ask a question about it, or request audio from text. Both use built-in AI without your own API key and should run only after a deliberate user action.

Ask a question about an image

Image understanding can describe a scene, suggest draft alt text, discuss a visual composition, or answer a focused question about a supplied image. The result is text, not an edited image. New React output uses the built-in ai.vision method.

Accept PNG, JPEG, WebP, or GIF images up to 4 MB and prompts up to 8,000 characters. Show the chosen image and question before analysis. Validate the file and keep it selected if the request fails, so the visitor can correct or retry the request.

Turn chosen text into playable audio

A read-aloud button can speak a short article, an explanation, or an AI-generated answer. React output uses ai.speech and displays the returned audio in a player. Speech text supports up to 4,000 characters; longer material needs an explicit selection or shorter passage.

Include playback controls and preserve the written text. Browsers may require another press of Play after audio generation. Make it clear when audio has been generated but has not started playing.

Example: describe a photo and read the result

Build a photo description tool. Let a visitor choose a PNG, JPEG, WebP, or GIF under 4 MB and enter a question. Add an Analyze image button using Div-idy’s built-in image understanding. Display the answer as editable text. Add a separate Read aloud button for up to 4,000 characters, followed by an audio player. Show loading and errors for each action.

Keep analysis and speech under user control

Analysis and speech are separate AI requests. Choosing a file should not immediately analyze it, and receiving an answer should not automatically generate audio. Disable each initiating control while its request is pending and let the visitor retry explicitly.

Saved AI Context can inform image understanding as well as text responses. Speech reads the text supplied to it. Check the words before generating audio, particularly if they came from an earlier AI answer.

Test formats, playback, and limits

Try a supported image, an oversized file, an empty question, an analysis failure, and audio playback on mobile. Review descriptions for accuracy before using them as final copy.

The generated-app runtime does not currently provide audio transcription, image editing, or real-time voice conversations. Image understanding and speech use the owner’s AI Tools budget; see image generation to create new images instead.