klein-lora-studio / README.md
rainey's picture
Deploy from GitHub Actions
8547a3c verified
|
Raw
History Blame Contribute Delete
4.07 kB

A newer version of the Gradio SDK is available: 6.20.0

Upgrade
metadata
title: Klein LoRA Studio
emoji: 🎨
colorFrom: green
colorTo: gray
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
license: apache-2.0
suggested_hardware: zero-a10g
short_description: Restyle photos with your own trained klein 4B signature look
models:
  - black-forest-labs/FLUX.2-klein-4B
  - black-forest-labs/FLUX.2-klein-base-4B
tags:
  - build-small-hackathon
  - backyard-ai
  - tiny-titan
  - off-brand
  - best-demo
  - flux
  - image-to-image
  - lora

🎨 Klein LoRA Studio

Restyle a photo into a named look — and make that look yours. Drop in a photo, pick a look (Scandinavian, Cottagecore, Watercolor…), and see a clean before → after. Load a .safetensors LoRA you trained and the look becomes a consistent signature — the thing a plain prompt can't give you. Built for the Build Small Hackathon (🏡 Backyard AI track) on FLUX.2 [klein] 4B.

▶️ Demo video: add link  ·  📣 Social post: add link

How it works

  1. Upload a photo (a room, an outfit, a garden…).
  2. Pick a look — each is a curated edit prompt. See Before | After side by side.
  3. Optional: load your signature LoRA (.safetensors) + a strength slider, so every restyle carries your aesthetic — consistent across a whole set.

Idea & tech (Build Small write-up)

  • The insight. Named presets hide the prompt engineering; a LoRA makes the look consistent and recognizable — not promptable by anyone. Before/after demos far better than a single image.
  • The model. FLUX.2-klein-4B — 4B params, Apache 2.0, runs on the Space GPU (~13 GB, 4-step distilled).
  • The engine. A diffusers Flux2KleinPipeline in image→image mode (ZeroGPU pattern: build on CPU at module scope, move to GPU in @spaces.GPU). A .safetensors LoRA is attached with load_lora_weights(...) / set_adapters(...) and always unloaded in a finally so the shared pipe stays clean. peft is the diffusers LoRA backend.
  • The craft. Curated look presets + an optional signature LoRA + a before/after layout, in a custom single-purpose UI (not the stock starter tabs).
  • Renders reliably on Spaces. System-font theme (no Google-Fonts fetch) and ssr_mode=False.

Get a signature LoRA (≈ $0.50, ≈ 30 min)

No LoRA needed to try the looks — but training one is the whole point. See TRAIN_A_LORA.md and configs/my_lora_klein_4b.yaml: 15–40 images of one aesthetic, caption content only with a coined trigger, train on FLUX.2-klein-base-4B via AI Toolkit, then upload the .safetensors here.

Why it fits "Build Small"

Rule / badge How Klein LoRA Studio delivers it
REQ-01 · Models ≤ 32B klein 4B (+ tiny LoRA) — also ≤ 4B → 🏅 Tiny Titan.
REQ-02 · Gradio app in the org A Gradio Space; deploy/duplicate into the Build Small HF org.
REQ-03 · Demo video add link above
REQ-04 · Social post add link above
REQ-05 · ZeroGPU limit Single ZeroGPU Space (zero-a10g).
REQ-06 · Tagged README Track + badge tags + this write-up.
🎨 Off Brand Custom before/after studio UI.
🎬 Best Demo Side-by-side restyle + a signature LoRA tells a story.

Submission checklist

  • Runs on klein 4B (≤ 32B, and ≤ 4B for Tiny Titan)
  • Gradio Space
  • Demo video recorded + linked above
  • One social post + linked above
  • Space uploaded into the Build Small org
  • README tagged with track + badges + write-up

Links: FLUX.2 [klein] · GitHub · Docs · Build Small Hackathon

Built on the klein Build Small starter.