日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

快速開始

通義萬相

說明

支持的領域 / 任務:aigc

通義萬相是基于自研的Composer組合生成框架的AI繪畫創作大模型,提供了一系列的圖像生成能力。支持根據用戶輸入的文字內容,生成符合語義描述的不同風格的圖像,或者根據用戶輸入的圖像,生成不同用途的圖像結果。通過知識重組與可變維度擴散模型,加速收斂并提升最終生成圖片的效果。圖像結果貼合語義,構圖自然、細節豐富。支持中英文雙語輸入。

通義萬相大模型系列目前支持了文字生成圖像、人像風格重繪、圖像背景生成等多個模型。

快速開始

前提條件

示例代碼

說明

以下以Dashscope SDK調用通義萬相-文本生成圖像模型為例,其他更多模型的調用與示例代碼,請查看其對應的API詳情文檔。

設置API-KEY

 export DASHSCOPE_API_KEY=YOUR_DASHSCOPE_API_KEY

from http import HTTPStatus
from urllib.parse import urlparse, unquote
from pathlib import PurePosixPath
import requests
import dashscope


def simple_call():
    prompt = 'Mouse rides elephant'
    rsp = dashscope.ImageSynthesis.call(model=dashscope.ImageSynthesis.Models.wanx_v1,
                              prompt=prompt,
                              n=4,
                              size='1024*1024')
    if rsp.status_code == HTTPStatus.OK:
        print(rsp.output)
        print(rsp.usage)
        # save file to current directory
        for result in rsp.output.results:
            file_name = PurePosixPath(unquote(urlparse(result.url).path)).parts[-1]
            with open('./%s' % file_name, 'wb+') as f:
                f.write(requests.get(result.url).content)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))


if __name__ == '__main__':
    simple_call()
// Copyright (c) Alibaba, Inc. and its affiliates.

import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesis;
import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesisParam;
import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.NoApiKeyException;

public class Main {
  public static void basicCall() throws ApiException, NoApiKeyException {
    ImageSynthesis is = new ImageSynthesis();
    ImageSynthesisParam param =
        ImageSynthesisParam.builder()
            .model(ImageSynthesis.Models.WANX_V1)
            .n(4)
            .size("1024*1024")
            .prompt("雄鷹自由自在的在藍天白云下飛翔")
            .build();

    ImageSynthesisResult result = is.call(param);
    System.out.println(result);
  }

  public static void main(String[] args){
    try{
      basicCall();
    }catch(ApiException|NoApiKeyException e){
      System.out.println(e.getMessage());
    }
    System.exit(0);
  }
}

調用成功后,將會返回如下示例結果。

{
  "task_id": "dcc42498-3bc3-4931-9199-41394fe58e1c",
  "task_status": "SUCCEEDED",
  "results": [
    {
      "url": "RESULT_URL1"
    },
    {
      "url": "RESULT_URL2"
    },
    {
      "url": "RESULT_URL3"
    },
    {
      "url": "RESULT_URL4"
    }
  ],
  "submit_time": "2024-07-19 14:25:33.529",
  "scheduled_time": "2024-07-19 14:25:33.576",
  "end_time": "2024-07-19 14:26:02.911",
  "task_metrics": {
    "TOTAL": 4,
    "SUCCEEDED": 4,
    "FAILED": 0
  }
}

了解更多

有關通義萬相系列模型API的詳細調用文檔可前往文本生成圖像API詳情人像風格重繪API詳情圖像背景生成API詳情頁面進行了解。