Ming-Image-0.1-Design-Layer
A 6B image-to-image model that decomposes flattened designs into independently editable RGBA layers using an image and layer plan.
Model details
View repositoryinclusionAI’s Ming-Image-0.1-Design-Layer is a 6B-parameter image-to-image model that decomposes flattened visual designs into independently editable RGBA layers. Guided by a text-based layer plan or requested layer count, it preserves the source image’s aspect ratio and produces transparent PNG assets for editing and recomposition. It is optimized for 1024-pixel processing with 12 sampling steps and a CFG scale of 2.0.
1import base64
2import os
3from pathlib import Path
4
5import requests
6
7model_id = "<your-model-id>"
8url = (
9 f"https://model-{model_id}.api.baseten.co"
10 "/environments/production/predict"
11)
12
13# Encode the flattened design image.
14input_image = base64.b64encode(
15 Path("design.png").read_bytes()
16).decode("utf-8")
17
18response = requests.post(
19 url,
20 headers={
21 "Authorization": f"Bearer {os.environ['BASETEN_API_KEY']}",
22 "Content-Type": "application/json",
23 },
24 json={
25 "input_image": input_image,
26 "prompt": "Decompose this image into 6 independently editable layers.",
27 "resolution": 1024,
28 "num_inference_steps": 12,
29 "guidance_scale": 2.0,
30 },
31 timeout=300,
32)
33response.raise_for_status()
34
35# Decode and save each generated RGBA layer.
36layers = response.json()["data"]
37
38for index, encoded_layer in enumerate(layers, start=1):
39 # Handle either raw base64 or a data URL.
40 if encoded_layer.startswith("data:"):
41 encoded_layer = encoded_layer.split(",", 1)[1]
42
43 output_path = Path(f"layer_{index:02d}.png")
44 output_path.write_bytes(base64.b64decode(encoded_layer))
45 print(f"Saved {output_path}")