提交修改
This commit is contained in:
parent
cf2221642f
commit
db6ea5cd54
@ -23,8 +23,14 @@ public class AExtendImageStyleRequest {
|
||||
*/
|
||||
private String majorUrl;
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
*/
|
||||
private String styleBase64;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String majorBase64;
|
||||
}
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
package com.heyu.api.controller.imageenhan;
|
||||
|
||||
|
||||
import com.aliyun.imageenhan20190930.models.ExtendImageStyleResponse;
|
||||
import com.aliyun.imageenhan20190930.models.ExtendImageStyleResponseBody;
|
||||
import com.heyu.api.alibaba.handle.imageenhan.AExtendImageStyleHandle;
|
||||
import com.heyu.api.alibaba.request.imageenhan.AExtendImageStyleRequest;
|
||||
import com.heyu.api.controller.BaseController;
|
||||
import com.heyu.api.data.annotation.CacheResult;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.resp.imageenhan.ExtendImageStyleResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* https://next.api.aliyun.com/api/imageenhan/2019-09-30/ExtendImageStyle?lang=JAVA&RegionId=cn-shanghai&tab=DOC
|
||||
*
|
||||
* 风格迁移
|
||||
*
|
||||
* ExtendImageStyle
|
||||
*
|
||||
*
|
||||
* 功能描述
|
||||
* 风格迁移能力可以对输入图像的风格进行转换,使得图像的色彩、笔触等视觉风格发生转化。 关于该接口功能的示例图如下:
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/image")
|
||||
@NotIntercept
|
||||
public class ExtendImageStyleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AExtendImageStyleHandle aExtendImageStyleHandle;
|
||||
|
||||
|
||||
@RequestMapping("/extendStyle")
|
||||
@CacheResult
|
||||
public R extendStyle(AExtendImageStyleRequest req) {
|
||||
ExtendImageStyleResp resp = new ExtendImageStyleResp();
|
||||
|
||||
ApiR<ExtendImageStyleResponse> aR = aExtendImageStyleHandle.handle(req);
|
||||
if (aR.isSuccess() && isSuccessStatusCode(aR.getData().getStatusCode())) {
|
||||
ExtendImageStyleResponseBody.ExtendImageStyleResponseBodyData responseBodyData = aR.getData().getBody().getData();
|
||||
resp.setImageURL(responseBodyData.getUrl());
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
return R.error(aR.getErrorMsg());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.heyu.api.controller.imageenhan;
|
||||
|
||||
import com.aliyun.imageenhan20190930.models.GenerateCartoonizedImageResponse;
|
||||
import com.aliyun.imageenhan20190930.models.GenerateCartoonizedImageResponseBody;
|
||||
import com.heyu.api.alibaba.handle.imageenhan.AGenerateCartoonizedImageHandle;
|
||||
import com.heyu.api.alibaba.request.imageenhan.AGenerateCartoonizedImageRequest;
|
||||
import com.heyu.api.controller.BaseController;
|
||||
import com.heyu.api.data.annotation.CacheResult;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.request.imageenhan.GenerateCartoonizedReq;
|
||||
import com.heyu.api.resp.imageenhan.GenerateCartoonizedResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* https://next.api.aliyun.com/api/imageenhan/2019-09-30/GenerateCartoonizedImage?tab=DOC&lang=JAVA
|
||||
* 生成式图像卡通化
|
||||
* <p>
|
||||
* GenerateCartoonized mage
|
||||
*
|
||||
* 功能描述
|
||||
* 基于生成式大模型实现多种特效风格的图像生成。输入一张图像,选择想要生成的卡通化风格,即可生成与输入图像相同分辨率、特定风格的卡通化图像。 关于该接口功能的示意图如下(左侧为原图,右侧为处理后图片):
|
||||
*
|
||||
*应用场景
|
||||
* 社交软件头像生成:用户可上传自拍照、萌宠、风景照,根据个人喜好指定卡通画风格,生成对应图片,可玩性较高。
|
||||
*
|
||||
* 特色优势
|
||||
* 卡通化要素广:基于生成式大模型,能够对人像、宠物、场景等要素进行处理,生成细腻生动的卡通化效果。
|
||||
* 风格多样:支持多种生成风格,满足不同用户的喜好和需求。
|
||||
* 智能化:可根据输入图片的人物性别、场景类别等进行智能识别,使得输出的图片在满足趣味性和美感的情况下贴近原图。
|
||||
* 高质量:生成图像质量高,瑕疵少。
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/image")
|
||||
@NotIntercept
|
||||
public class GenerateCartoonizedController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AGenerateCartoonizedImageHandle generateCartoonizedImageHandle;
|
||||
|
||||
|
||||
@RequestMapping("/cartoonized")
|
||||
@CacheResult
|
||||
public R cartoonized(GenerateCartoonizedReq req) {
|
||||
GenerateCartoonizedResp resp = new GenerateCartoonizedResp();
|
||||
|
||||
AGenerateCartoonizedImageRequest request = new AGenerateCartoonizedImageRequest();
|
||||
request.setCartoonizedType(req.getCartoonizedType());
|
||||
request.setImageUrl(req.getImageUrl());
|
||||
request.setImageBase64(req.getImageBase64());
|
||||
|
||||
ApiR<GenerateCartoonizedImageResponse> aR = generateCartoonizedImageHandle.handle(request);
|
||||
if (aR.isSuccess() && isSuccessStatusCode(aR.getData().getStatusCode())) {
|
||||
GenerateCartoonizedImageResponseBody.GenerateCartoonizedImageResponseBodyData responseBodyData = aR.getData().getBody().getData();
|
||||
resp.setImageURL(responseBodyData.getResultUrl());
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
|
||||
return R.error(aR.getErrorMsg());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.heyu.api.request.imageenhan;
|
||||
|
||||
|
||||
import com.heyu.api.request.CommonReq;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExtendImageStyleReq extends CommonReq {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.heyu.api.request.imageenhan;
|
||||
|
||||
|
||||
import com.heyu.api.request.CommonReq;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GenerateCartoonizedReq extends CommonReq {
|
||||
|
||||
|
||||
/**
|
||||
* 卡通效果。取值如下:
|
||||
*
|
||||
* 0:复古漫画(默认)
|
||||
* 1:3D 童话
|
||||
* 2:二次元
|
||||
* 3:小清新
|
||||
* 4:未来科技
|
||||
* 5:国画古风
|
||||
* 6: 将军百战
|
||||
* 7: 炫彩卡通
|
||||
* 8:清雅国风n
|
||||
*/
|
||||
private Integer cartoonizedType = "0";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.heyu.api.resp.imageenhan;
|
||||
|
||||
|
||||
import com.heyu.api.resp.CommonImageUrlResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExtendImageStyleResp extends CommonImageUrlResp {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.heyu.api.resp.imageenhan;
|
||||
|
||||
|
||||
import com.heyu.api.resp.CommonImageUrlResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GenerateCartoonizedResp extends CommonImageUrlResp {
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user