chinese-hershey-font
Convert Chinese Characters to Single-Line Fonts using Computer Vision
A web app that dynamically generates playable 'Spot the Difference' games from a single text prompt using a multimodal…
git clone https://github.com/seehiong/prompt-to-puzzle.gitseehiong/prompt-to-puzzleA submission for the Google AI Multi-Modal Challenge.
This web application leverages the power of Google's Gemini and Imagen models to dynamically generate playable "Spot the Difference" games from a single text prompt.
The goal was to create a truly interactive and generative experience using a multi-modal AI workflow. Instead of just generating an image or text, this project uses AI as a creative partner in a two-step process: first to create a world (the base image), and then to subtly alter it (the modified image). The challenge of programmatically finding those differences without further AI calls led to an interesting blend of cutting-edge AI generation and classic computer vision techniques.
gemini-2.5-flash-image-preview to intelligently add or remove elements from a base image.The application employs a fascinating multi-stage process to create each game.
Tech Stack:
imagen-4.0-generate-001: Used for generating the high-quality base image from the user's text prompt.gemini-2.5-flash-image-preview: The core of the difference generation. This multi-modal model takes the base image and a text prompt instructing it to make several subtle but significant changes.The Generation & Analysis Pipeline:
This application requires several environment variables to be set. For deployment (e.g., Cloud Run), the web server should make these available to the client-side JavaScript. For local development, see the setup instructions below.
API_KEY: Your Google AI API key for Gemini models. You can get one from Google AI Studio.APPWRITE_ENDPOINT: The API endpoint for your Appwrite instance (e.g., https://cloud.appwrite.io/v1).APPWRITE_PROJECT_ID: The Project ID from your Appwrite console.APPWRITE_BUCKET_ID: The Storage Bucket ID where generated images will be stored. The bucket must have permissions configured to allow the 'Users' role (anonymous users) to 'Create' files.APPWRITE_DATABASE_ID: The Database ID from your Appwrite project where the 'games' collection will be created.Note: The application code accesses these variables from the global scope, for example (self as any).environment.API_KEY. It does not use process.env.
For the application to communicate with Appwrite Cloud from your local machine, you must register your local development environment as a Web Platform in your Appwrite project. This is a crucial security step that tells Appwrite to accept API requests originating from localhost.
localhost.Without this configuration, you will encounter authentication errors when running the app locally, which will prevent images from being saved.
The application uses Appwrite Databases to save curated games. You must run a one-time setup script to prepare your database.
Create a Database: In your Appwrite project console, go to Databases and create a new database. You can name it "spot-the-diff". Note its Database ID.
Create an API Key: In your Appwrite console, go to API Keys. Create a new API key with the databases.write permission. Note the Secret.
Run the Setup Script:
The migrations/setup-appwrite.ts script creates the necessary collection and attributes. To run it, you'll need a Node.js environment with ts-node and node-appwrite installed.
# Install dependencies locally or globally npm install ts-node node-appwrite
Execute the script from the project root, providing your credentials as environment variables. Replace the placeholder values.
APPWRITE_ENDPOINT="https://cloud.appwrite.io/v1" \ APPWRITE_PROJECT_ID="<YOUR_PROJECT_ID>" \ APPWRITE_API_KEY="<YOUR_SECRET_API_KEY>" \ APPWRITE_DATABASE_ID="<YOUR_DATABASE_ID>" \ npx ts-node migrations/setup-appwrite.ts
The script will connect to your Appwrite instance and create a games collection inside the database you created.
Clone the repository:
git clone https://github.com/seehiong/gemini-spot-the-diff-generator.git cd gemini-spot-the-diff-generator
Set Environment Variables: For local development, you will need a way to serve the static files while making the environment variables available to the JavaScript code. One common method is to use a simple server that can inject these variables.
Serve the application:
Serve the static files (like index.html) using a local web server. All dependencies are loaded via CDN, so no npm install is required for the web app itself.
more like this
Convert Chinese Characters to Single-Line Fonts using Computer Vision
🎥🤟 8 minimalistic templates for tfjs mediapipe handpose and facemesh
search projects, people, and tags