How cheazer/gemini-multimodal-workshop works
Snap & Ask is a browser-based multimodal Gemini app. Users add an image, choose a preset or question, then request either a streamed text answer or schema-shaped JSON. The UI manages image preparation and browser-local API-key storage; the main module coordinates those inputs and the Gemini calls. README capabilities include sample images, several preset applications, and both response modes. The sampled files show the main wiring; sample assets and page markup are not represented as source components.
Main entry points: main.js App coordinator · ui.js Image, key and output UI · gemini.js Text response · presets.js App presets and schemas
Components 10
Browser interface
- Image, key and output UI
src/ui.js - App coordinator
src/main.js
Prompt and presets
- App presets and schemas
src/presets.js - Multimodal contents
src/gemini.js
Gemini requests
- Text response
src/gemini.js - Structured response
src/gemini.js
Other components
- User
- Google Gemini API
- Browser local storage
- Sample images
public/samples
Connections 11
- User → Image, key and output UI: chooses image/key
src/ui.js - Image, key and output UI → Browser local storage: reads/writes key
src/ui.js - App coordinator → Image, key and output UI: reads inputs; updates output
src/main.js - App coordinator → App presets and schemas: loads preset
src/main.js - App coordinator → Image, key and output UI: loads sample
src/main.js - Image, key and output UI → Sample images: fetches image
src/ui.js - App coordinator → Multimodal contents: builds contents
src/main.js - App coordinator → Text response: requests streaming answer
src/main.js - App coordinator → Structured response: requests JSON answer
src/main.js - Text response → Google Gemini API: streams generation
src/gemini.js - Structured response → Google Gemini API: generates JSON
src/gemini.js