宠物写真

创建时间: 2026-07-03 16:29 | 步骤: 4 个

工作流描述

基于用户上传的宠物原图,通过视觉特征提取、提示词智能构建与图生图渲染,生成高保真保留宠物本体特征的拟人化高清写真图片。

工作流输出

流程步骤 共 4 步

1宠物特征解析与质量评估
2宠物拟人写真提示词构建
3启动拟人写真渲染任务
4轮询写真渲染状态
工作流定义 (JSON)134 行
{
  "workflow_id": "pet_personified_portrait_generation",
  "input": {
    "style_type": {
      "field_name": "style_type",
      "default": "古风汉服",
      "description": "拟人化写真风格,如:古风汉服、凤冠霞帔、西式婚纱、西装礼服、新中式国潮、日系清新、复古港风、可爱童趣、暗黑高级、森系治愈",
      "example": "blingbling",
      "type": "string",
      "required": true
    },
    "pet_image": {
      "field_name": "pet_image",
      "default": "",
      "description": "待处理宠物原图(支持URL或Base64编码),优先正脸/半身清晰无遮挡照片",
      "example": "https://oss.showapi.com/doc/4888/51/fe069a15f01a_1783060964774.jpg?x-oss-process=image/resize,p_100",
      "type": "base64",
      "required": true
    },
    "aspect_ratio": {
      "field_name": "aspect_ratio",
      "default": "1:1",
      "description": "生图宽高比,可选值:1:1、3:4、4:3、16:9、9:16",
      "example": "1:1",
      "type": "string",
      "required": false
    }
  },
  "steps": [
    {
      "point_code": "",
      "id": "step_1_pet_feature_analyze",
      "result": [],
      "api_code": "pet_feature_analyze",
      "backend_type": "prompt_api",
      "status": "PENDING",
      "name": "宠物特征解析与质量评估",
      "action": "run",
      "params": {
        "img_list": [
          {
            "url": "{{@input.pet_image}}"
          }
        ],
        "user_prompt": "详细分析图中的宠物:1.识别种类(如布偶猫、柯基);2.描述毛色与花纹特征;3.描述五官特征(眼色、耳型等);4.评估面部遮挡程度(无遮挡/轻度/重度)及是否正脸;5.评估图片清晰度。输出需简洁结构化。"
      }
    },
    {
      "point_code": "",
      "id": "step_2_prompt_build",
      "result": [],
      "api_code": "pet_prompt_build",
      "backend_type": "prompt_api",
      "status": "PENDING",
      "name": "宠物拟人写真提示词构建",
      "action": "run",
      "params": {
        "style_type": "{{@input.style_type}}",
        "face_occlusion_level": "{{@step_1_pet_feature_analyze.result.data.structured_analysis.entities.3.value}}",
        "pet_features": "{{@step_1_pet_feature_analyze.result.data.structured_analysis.keywords}}"
      },
      "depends_on": [
        "step_1_pet_feature_analyze"
      ]
    },
    {
      "point_code": "1",
      "id": "step_3_start_image_task",
      "result": [],
      "api_code": "3373",
      "backend_type": "sys_api",
      "status": "PENDING",
      "name": "启动拟人写真渲染任务",
      "action": "run",
      "params": {
        "referImages": [
          "{{@input.pet_image}}"
        ],
        "prompt": "{{@step_2_prompt_build.result.data.content_variants.1.content}}",
        "aspect_ratio": "{{@input.aspect_ratio}}"
      },
      "depends_on": [
        "step_2_prompt_build"
      ]
    },
    {
      "id": "step_4_poll_image_status",
      "point_code": "",
      "result": [],
      "api_code": "polling",
      "backend_type": "sys_api",
      "status": "PENDING",
      "name": "轮询写真渲染状态",
      "action": "run",
      "params": {
        "result_url": "{{@step_3_start_image_task.result.data.result_url}}"
      },
      "depends_on": [
        "step_3_start_image_task"
      ],
      "polling": {
        "interval_seconds": 5,
        "timeout_seconds": 600,
        "success_condition": "{{@step_4_poll_image_status.result.data.task_status}} === 'SUCCEEDED'"
      }
    }
  ],
  "output": {
    "portrait_image_url": {
      "field_name": "portrait_image_url",
      "description": "生成的宠物拟人写真高清图片URL",
      "value": "{{@step_4_poll_image_status.result.data.result_url}}",
      "type": "string"
    },
    "negative_prompt": {
      "field_name": "negative_prompt",
      "description": "最终使用的反向生图提示词",
      "value": "{{@step_2_prompt_build.result.data.content_variants.2.content}}",
      "type": "string"
    },
    "pet_features": {
      "field_name": "pet_features",
      "description": "识别的宠物核心特征关键词列表",
      "value": "{{@step_1_pet_feature_analyze.result.data.structured_analysis.keywords}}",
      "type": "array"
    },
    "positive_prompt": {
      "field_name": "positive_prompt",
      "description": "最终使用的正向生图提示词",
      "value": "{{@step_2_prompt_build.result.data.content_variants.1.content}}",
      "type": "string"
    }
  }
}