Skip to content

White-Tiger-Cyber/mochi-gallery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mochimo Gallery Generator

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.

⚠️ Prerequisites: Google API Setup

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.

  1. Go to Google AI Studio and get an API Key.
  2. Ensure your project has billing enabled to access the imagen-4.0 models.

Installation

1. Clone the Repository

git clone https://github.com/White-Tiger-Cyber/mochi-gallery.git
cd mochi-gallery

2. Set up the Environment

It 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 .

3. Configuration (.env)

Create a .env file in the root directory:

touch .env

Add your key:

GEMINI_API_KEY="AIzaSy...YourKeyHere"

4. Install Fonts (Critical)

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 ../..

🖥️ Using the Web Studio (Recommended)

The easiest way to use Mochimo Gallery is the web interface.

  1. Start the Server:
    python3 app.py
  2. Open Browser: Go to http://localhost:5000
  3. Generate: Enter a block number, pick a style/model, and click Generate.
  4. View: Click "View Gallery" to see your collection with filters and lightboxes.

💻 Using the CLI (Advanced)

The CLI is perfect for batch jobs, automated watching, or scripting.

Basic Generation

mochi-gallery 880030

Apply Art Styles

Use the short name of any JSON file in assets/styles/.

mochi-gallery 880030 --style ghibli

Batch & Ranges

Generate art for a sequence of blocks automatically.

mochi-gallery 880000-880010 --style quantum

Watcher Mode (Daemon)

Continuously 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 fast

Configuration & Customization

Switching Models (Speed vs Quality)

You 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).

Creating Custom Styles

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."
}

Troubleshooting

  • Error 429 (Resource Exhausted): You hit your daily image quota. Switch to the fast model or use --mock to 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.py is running, as browsers block local file access for security.

License

MIT License. See LICENSE file for details.

About

Mochimo Block Haiku Visualizer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published