e-os-v5 / scripts /test_os5_styles.py
KillerBoss's picture
E-OS v0.5: Style-Morphing Full-Frame Generative OS (NPU 1.12ms)
ce521ce verified
Raw History Blame Contribute Delete
1.44 kB
# v5 smoke test: render hint+styled for all 3 styles (home) + weather variants
import sys
sys.path.insert(0, "/home/z/my-project/scripts/os5")
import os5_draw as D
import gen_os5_dataset as G
from PIL import Image
rows = []
for style in range(3):
st = G.gen_scene(4242 + style)
st["screen"] = 1; st["style"] = style; st["mood"] = 2; st["energy"] = 1.0
st["weather_cond"] = 0
hint = D.draw_scene(st, "hint")
styled = D.draw_scene(st, "styled")
h2 = hint.resize(styled.size)
rows.append((styled, h2, "style=%d (%s)" % (style, ["Neon", "Glas", "Aurora"][style])))
# weather variants in style 0
for wc in range(4):
st = G.gen_scene(777)
st["screen"] = 4; st["style"] = 0; st["weather_cond"] = wc; st["mood"] = 1; st["energy"] = 0.6
styled = D.draw_scene(st, "styled")
rows.append((styled, styled, "weather=%d" % wc))
W = 384
sheet = Image.new("RGB", (W * 2 * 3 // 2, 0), (0, 0, 0))
imgs = []
for styled, hint, label in rows:
pair = Image.new("RGB", (W * 2, 832), (0, 0, 0))
pair.paste(hint, (0, 0)); pair.paste(styled, (W, 0))
imgs.append(pair)
half = [im.resize((im.width * 3 // 5, im.height * 3 // 5)) for im in imgs]
total_h = sum(im.height for im in half)
sheet = Image.new("RGB", (half[0].width, total_h), (0, 0, 0))
y = 0
for im in half:
sheet.paste(im, (0, y)); y += im.height
sheet.save("/home/z/my-project/download/os5_style_preview.png")
print("saved preview", sheet.size)