使用多模态图片识别,精准分析UI语义信息
注:这里使用大模型为qwen/qwen2.5-vl-32b-instruct:free
{ "background": { "color": "#000000" // 黑色背景 }, "elements": [ { "name": "statusBar", "description": "手机顶部的状态栏区域", "coordinate": { "left": 0, "top": 0, "width": 1000, "height": 90 }, "children": [ { "name": "time", "description": "当前时间显示区域", "coordinate": { "left": 40, "top": 40, "width": 80, "height": 30 }, "text": "9:07", "color": "#CCCCCC" // 浅灰色文字 }, { "name": "appIcons", "description": "应用图标区域", "coordinate": { "left": 130, "top": 40, "width": 120, "height": 30 }, "children": [ { "name": "redIcon", "description": "红色应用图标", "coordinate": { "left": 130, "top": 40, "width": 30, "height": 30 }, "color": "#FF0000" // 红色 }, { "name": "blueIcon", "description": "蓝色应用图标", "coordinate": { "left": 170, "top": 40, "width": 30, "height": 30 }, "color": "#0000FF" // 蓝色 }, { "name": "greenIcon", "description": "绿色应用图标", "coordinate": { "left": 210, "top": 40, "width": 30, "height": 30 }, "color": "#00FF00" // 绿色 } ] } ] } ] }
将上述手机APP的UI元素的JSON格式描述,转为html编写它的UI效果页。注意兼容多个手机规格,最好自适应多终端平台——甚至是PC
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>DeepSeek Chat UI</title> <style> /* 全局样式 */ * { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; } body { background-color: #000; color: #ccc; max-width: 100vw; min-height: 100vh; display: flex; flex-direction: column; } /* 状态栏样式 */ .status-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; height: 60px; background-color: #000; } .time { font-size: 16px; font-weight: 500; } .app-icons { display: flex; gap: 10px; } .app-icon { width: 20px; height: 20px; border-radius: 4px; } /* 更多样式... */ </style> </head> <body> <!-- 状态栏 --> <div class="status-bar"> <div class="time">9:07</div> <div class="app-icons"> <div class="app-icon" style="background-color: #FF0000;"></div> <div class="app-icon" style="background-color: #0000FF;"></div> <div class="app-icon" style="background-color: #00FF00;"></div> </div> </div> <!-- 更多HTML内容... --> </body> </html>