风格迁移

优质
小牛编辑
118浏览
2023-12-01

利用人工智能技术将输入照片按照风格照片进行风格迁移

风格迁移API调用示例代码

github地址: https://github.com/picup-shop

  • Python
  • PHP
  • Java
  • Objective-c
  • import requests
    
    url = 'https://picupapi.tukeli.net/api/v1/styleTransferBase64'
    apikey = '你的apikey'
    headers={'APIKEY': apikey, "Content-type": "application/json"}
    data = {
      "contentBase64": "/9j/4AAQSkZJRgA...此处省略base64一万字,注意,有的人测试的时候使用在线base64转化工具,注意将data:image/jpg;base64,这部分字符串去除",
      "styleBase64": "/9j/4AAQSkZJRgA..."
    }
    response=requests.post(url=url,headers=headers,json=data)
    print(response.content)
  • import requests
    
    url = 'https://picupapi.tukeli.net/api/v1/styleTransferBase64'
    apikey = '你的apikey'
    headers={'APIKEY': apikey, "Content-type": "application/json"}
    data = {
      "contentBase64": "/9j/4AAQSkZJRgA...此处省略base64一万字,注意,有的人测试的时候使用在线base64转化工具,注意将data:image/jpg;base64,这部分字符串去除",
      "styleBase64": "/9j/4AAQSkZJRgA..."
    }
    response=requests.post(url=url,headers=headers,json=data)
    print(response.content)
  • import requests
    
    url = 'https://picupapi.tukeli.net/api/v1/styleTransferBase64'
    apikey = '你的apikey'
    headers={'APIKEY': apikey, "Content-type": "application/json"}
    data = {
      "contentBase64": "/9j/4AAQSkZJRgA...此处省略base64一万字,注意,有的人测试的时候使用在线base64转化工具,注意将data:image/jpg;base64,这部分字符串去除",
      "styleBase64": "/9j/4AAQSkZJRgA..."
    }
    response=requests.post(url=url,headers=headers,json=data)
    print(response.content)
  • import requests
    
    url = 'https://picupapi.tukeli.net/api/v1/styleTransferBase64'
    apikey = '你的apikey'
    headers={'APIKEY': apikey, "Content-type": "application/json"}
    data = {
      "contentBase64": "/9j/4AAQSkZJRgA...此处省略base64一万字,注意,有的人测试的时候使用在线base64转化工具,注意将data:image/jpg;base64,这部分字符串去除",
      "styleBase64": "/9j/4AAQSkZJRgA..."
    }
    response=requests.post(url=url,headers=headers,json=data)
    print(response.content)

API文档说明

请求说明

  • 请求URl: https://picupapi.tukeli.net/api/v1/styleTransferBase64
  • 请求方式: POST
  • 返回类型: json数据
  • 输入参数:

    (1) 请求参数(Header)

    参数参数类型描述
    Content-Typestringmultipart/json
    APIKEYstring您的专属API Key

    (2) 请求参数(Body)

    {
        contentBase64 (string, required): 输入待转化的图片文件的base64 ,
        styleBase64 (string, required): 输入风格图片文件的base64
    }

    (3) 响应数据

    {
      "code": 0,
      "data": "http://wdpicup.oss-cn-hangzhou.xxxx", //处理完成后结果图片的临时url,请及时下载,五分钟内失效
      "msg": null,
      "time": 1599644436677
    }

价格说明

您可以通过在线充值付费方式,购买API调用点数。

查看价格列表

注意:API每次成功调用,消耗1点。

常见问题

  • Q:输入的图片格式有什么要求?
  • A:支持PNG、JPG、JPEG、BMP、GIF
  • Q:支持图片大小有限制吗?
  • A:目前上传的分辨率最大4096x4096像素,图片文件大小15MB以下