Mochimo Gallery is an AI art station that turns Mochimo Blockchain blocks into bespoke, high-fidelity posters.
It fetches the unique "Haiku" (nonce) from a specific block, uses Google Gemini as an Art Director to interpret the mood, and uses Google Imagen to render the illustration. Finally, a holistic design engine applies artistic typography based on the image's composition.
Features:
- 🖥️ Web Studio: A local graphical interface to explore blocks and generate art.
- 🖼️ Interactive Gallery: A filterable portfolio of your generated works.
- 🤖 CLI Daemon: A command-line tool for batch processing or watching the chain.
- 🎨 Style Engine: Supports custom JSON style definitions (Ghibli, Cyberpunk, Ansel Adams, etc).
Project Status: This is an experimental creative tool. It is designed to be run locally from the cloned repository.
To use this tool, you must have a Google Cloud account with billing enabled. Image generation via the API (Imagen 4) is a paid feature (Pay-as-you-go), though the cost is generally low per image.
- Go to Google AI Studio and get an API Key.
- Ensure your project has billing enabled to access the
imagen-4.0models.
git clone https://github.com/White-Tiger-Cyber/mochi-gallery.git
cd mochi-galleryIt is recommended to use a virtual environment.
# Create and activate venv
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies (Flask, GenAI, Pillow, etc.)
pip install -e .Create a .env file in the root directory:
touch .envAdd your key:
GEMINI_API_KEY="AIzaSy...YourKeyHere"The tool uses a "Holistic Vibe" engine that picks fonts based on the mood. Run these commands to download the required open-source fonts:
cd assets/fonts
wget -O handwritten_caveat.ttf "https://github.com/google/fonts/raw/main/ofl/caveat/Caveat%5Bwght%5D.ttf"
wget -O typewriter_roboto.ttf https://github.com/google/fonts/raw/main/ofl/spacemono/SpaceMono-Regular.ttf
wget -O serif_playfair.ttf https://github.com/google/fonts/raw/main/ofl/prata/Prata-Regular.ttf
wget -O sans_oswald.ttf "https://github.com/google/fonts/raw/main/ofl/oswald/Oswald%5Bwght%5D.ttf"
cd ../..The easiest way to use Mochimo Gallery is the web interface.
- Start the Server:
python3 app.py
- Open Browser: Go to
http://localhost:5000 - Generate: Enter a block number, pick a style/model, and click Generate.
- View: Click "View Gallery" to see your collection with filters and lightboxes.
The CLI is perfect for batch jobs, automated watching, or scripting.
mochi-gallery 880030Use the short name of any JSON file in assets/styles/.
mochi-gallery 880030 --style ghibliGenerate art for a sequence of blocks automatically.
mochi-gallery 880000-880010 --style quantumContinuously monitor the Mochimo network. When a new block is solved, the tool will wake up, generate the art, update the gallery, and go back to sleep.
mochi-gallery watch --style random --model fastYou can switch models in the Web UI dropdown or via the --model CLI flag.
fast(Imagen 4 Fast): Lowest latency, generous quota. Best for testing.standard(Imagen 4): Good balance.ultra(Imagen 4 Ultra): Highest fidelity, strict daily limits (~30/day).
Add a .json file to assets/styles/. The filename becomes the style ID.
Example oilpaint.json:
{
"style_name": "Heavy Impasto Oil",
"aspect_ratio": "3:4",
"visual_directives": "Thick impasto oil painting, palette knife texture, vibrant colors, expressive brushwork."
}- Error 429 (Resource Exhausted): You hit your daily image quota. Switch to the
fastmodel or use--mockto test layouts. - Error 404 (Not Found): Ensure your API Key project has billing enabled.
- Gallery Images Broken: If images don't load in the gallery, ensure
python3 app.pyis running, as browsers block local file access for security.
MIT License. See LICENSE file for details.