Views
No views yet
| Metric | Score |
|---|---|
| Overall Accuracy | 82% |
| High agreement pairs (≥80%) | 90.9% |
| Low agreement pairs (<80%) | 79.5% |
1import torch
2from transformers import Qwen3_5ForConditionalGeneration, AutoProcessor
3from qwen_vl_utils import process_vision_info
4
5model = Qwen3_5ForConditionalGeneration.from_pretrained(
6 "DillonNys/qwen-visual-design-judge",
7 torch_dtype=torch.bfloat16,
8 device_map="cuda",
9)
10processor = AutoProcessor.from_pretrained("DillonNys/qwen-visual-design-judge")
11
12def judge_pair(img_a: str, img_b: str) -> str:
13 prompt = """You are an expert visual design judge. Compare these two images and determine which has better visual design quality.
14
15Consider: layout, typography, color harmony, visual hierarchy, spacing, and overall aesthetic appeal.
16
17Respond with ONLY "A" or "B" to indicate the better design."""
18
19 messages = [{
20 "role": "user",
21 "content": [
22 {"type": "text", "text": prompt},
23 {"type": "text", "text": "\n\nImage A:"},
24 {"type": "image", "image": img_a},
25 {"type": "text", "text": "\n\nImage B:"},
26 {"type": "image", "image": img_b},
27 {"type": "text", "text": "\n\nWhich is better? Answer A or B:"},
28 ],
29 }]
30
31 text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
32 image_inputs, video_inputs = process_vision_info(messages)
33 inputs = processor(text=[text], images=image_inputs, videos=video_inputs, padding=True, return_tensors="pt").to("cuda")
34
35 with torch.no_grad():
36 output_ids = model.generate(**inputs, max_new_tokens=8, do_sample=False)
37
38 response = processor.decode(output_ids[0, inputs.input_ids.shape[1]:], skip_special_tokens=True).strip()
39 return "A" if "A" in response.upper() else "B"
40
41# Example
42winner = judge_pair("design_a.png", "design_b.png")
43print(f"Better design: {winner}")1@misc{qwen-visual-design-judge,
2 author = {Dillon Nys},
3 title = {Qwen Visual Design Judge},
4 year = {2026},
5 publisher = {HuggingFace},
6 url = {https://huggingface.co/DillonNys/qwen-visual-design-judge}
7}