|
|
@@ -32,6 +32,7 @@ public class AiVideoHelper { |
|
|
|
public static String uri = "http://nas.pucao.cn:2001"; |
|
|
|
|
|
|
|
public static String url = "http://nas.pucao.cn:2002/img_talking"; |
|
|
|
public static String url1 = "http://nas.pucao.cn:2002/image_qualit"; |
|
|
|
public static String doPost(String url, String params) { |
|
|
|
return HttpUtil.doAiVideoPost(url,params); |
|
|
|
} |
|
|
@@ -130,6 +131,38 @@ public class AiVideoHelper { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public static AiCheckPhotoResult checkPhoto(String str) { |
|
|
|
log.info("生成视频start request:" + str); |
|
|
|
String response = doPost(url1, JSONObject.toJSONString(str)); |
|
|
|
log.info("生成视频end response:" + response); |
|
|
|
AiCheckPhotoResult result = new AiCheckPhotoResult(); |
|
|
|
|
|
|
|
if (StringUtils.isBlank(response)) { |
|
|
|
result.setSuccess(false); |
|
|
|
result.setMsg("图片质量审核失败,请稍后重试"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
JSONObject jsonObject = JSON.parseObject(response); |
|
|
|
JSONObject status = jsonObject.getJSONObject("status"); |
|
|
|
Integer code = status.getInteger("code"); |
|
|
|
String msg = status.getString("msg"); |
|
|
|
if (code == null) { |
|
|
|
result.setSuccess(false); |
|
|
|
result.setMsg("请求生成视频异常,请稍后重试"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
if (code.intValue() == 2000) { |
|
|
|
result.setCode(code); |
|
|
|
result.setSuccess(true); |
|
|
|
result.setMsg(msg); |
|
|
|
} else { |
|
|
|
result.setCode(code); |
|
|
|
result.setSuccess(false); |
|
|
|
result.setMsg(msg); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
// AiVideoParam videoParam = new AiVideoParam(); |
|
|
|
// videoParam.setGen_txt("我写了一篇小说,你帮我看看。"); |
|
|
@@ -152,10 +185,10 @@ public class AiVideoHelper { |
|
|
|
// AiVideoResult video = AiVideoHelper.createVideo(videoParam); |
|
|
|
|
|
|
|
AiPhotoSpeakParam param = new AiPhotoSpeakParam(); |
|
|
|
param.setGen_txt("我写了一篇小说,你帮我看看。"); |
|
|
|
param.setImg(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/personmould/16739389169485046_nVi875Ej_grace_1080.jpg")); |
|
|
|
param.setGen_txt("dasdadklfjskjf"); |
|
|
|
param.setImg(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/digitalperson/16760216806604820_cSHoijDX_matting.png")); |
|
|
|
param.setGender("male"); |
|
|
|
param.setVoice_id("zh-CN-XiaohanNeural"); |
|
|
|
param.setVoice_id("en-US-BrandonNeural"); |
|
|
|
param.setVoice_style("default"); |
|
|
|
param.setUrl("None"); |
|
|
|
AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); |
|
|
|