当前位置: 首页 > news >正文

建设个人网站赚钱设计公司网站首页显示

建设个人网站赚钱,设计公司网站首页显示,企业活动网站创意案例,有限责任公司名称本笔记内容为黑马头条项目的文本-图片内容审核接口部分 目录 一、概述 二、准备工作 三、文本内容审核接口 四、图片审核接口 五、项目集成 一、概述 内容安全是识别服务#xff0c;支持对图片、视频、文本、语音等对象进行多样化场景检测#xff0c;有效降低内容违规风…本笔记内容为黑马头条项目的文本-图片内容审核接口部分 目录 一、概述 二、准备工作 三、文本内容审核接口 四、图片审核接口 五、项目集成 一、概述 内容安全是识别服务支持对图片、视频、文本、语音等对象进行多样化场景检测有效降低内容违规风险。 目前很多平台都支持内容检测如阿里云、腾讯云、百度AI、网易云等国内大型互联网公司都对外提供了API。 按照性能和收费来看黑马头条项目使用的就是阿里云的内容安全接口使用到了图片和文本的审核。 阿里云收费标准价格计算器 (aliyun.com) 二、准备工作 您在使用内容检测API之前需要先注册阿里云账号添加Access Key并签约云盾内容安全。   操作步骤 1、前往阿里云官网注册账号。如果已有注册账号请跳过此步骤。 进入阿里云首页后如果没有阿里云的账户需要先进行注册才可以进行登录。由于注册较为简单课程和讲义不在进行体现注册可以使用多种方式如淘宝账号、支付宝账号、微博账号等...。需要实名认证和活体认证。 2、打开云盾内容安全产品试用页面单击立即开通正式开通服务。 注意 现在这个服务需要企业认证才能使用  所以我改用了阿里视觉智能开发平台的审核功能视觉智能开放平台-控制台 (aliyun.com) 购买资源包我第一次购买不用钱免费送了1万点 3、在AccessKey管理页面管理您的AccessKeyID和AccessKeySecret。 管理自己的AccessKey,可以新建和删除AccessKey 查看自己的AccessKeyAccessKey默认是隐藏的第一次申请的时候可以保存AccessKey点击显示通过验证手机号后也可以查看 三、文本内容审核接口 文本垃圾内容检测 文本内容安全 (aliyun.com) 文本垃圾内容Java SDK: Java (aliyun.com) 四、图片审核接口 图片垃圾内容检测图片内容安全 (aliyun.com) 图片垃圾内容Java SDK:Java (aliyun.com) 五、项目集成 这里的代码是使用智能开发平台的审核功能 ①common模块下面添加工具类并添加到自动配置 aliyun包下的GreenImageScan.java和GreenTextScan.java GreenImageScan代码 package com.heima.common.aliyun;import com.alibaba.fastjson.JSON;import com.aliyun.imageaudit20191230.models.ScanImageRequest; import com.aliyun.imageaudit20191230.models.ScanImageResponse; import com.aliyun.imageaudit20191230.models.ScanImageResponseBody;import lombok.Getter; import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties;import org.springframework.stereotype.Component;import java.util.*;Getter Setter Component ConfigurationProperties(prefix aliyun) public class GreenImageScan {private String accessKeyId;private String secret;private String scenes;public Map imageScan(ListString imageList) throws Exception {com.aliyun.teaopenapi.models.Config config new com.aliyun.teaopenapi.models.Config().setAccessKeyId(accessKeyId).setAccessKeySecret(secret);// 访问的域名config.endpoint imageaudit.cn-shanghai.aliyuncs.com;com.aliyun.imageaudit20191230.Client client new com.aliyun.imageaudit20191230.Client(config);ListScanImageRequest.ScanImageRequestTask taskList new ArrayList();for (String img: imageList) {ScanImageRequest.ScanImageRequestTask task new ScanImageRequest.ScanImageRequestTask();task.setImageURL(img);task.setDataId(UUID.randomUUID().toString());task.setImageTimeMillisecond(1L);task.setInterval(1);task.setMaxFrames(1);taskList.add(task);}//场景ListString sceneList new ArrayList();sceneList.add(scenes);sceneList.add(logo);sceneList.add(porn);com.aliyun.imageaudit20191230.models.ScanImageRequest scanImageRequest new com.aliyun.imageaudit20191230.models.ScanImageRequest().setTask(taskList).setScene(sceneList);com.aliyun.teautil.models.RuntimeOptions runtime new com.aliyun.teautil.models.RuntimeOptions();try {ScanImageResponse scanImageResponse client.scanImageWithOptions(scanImageRequest, runtime);MapString, String resultMap new HashMap();if (scanImageResponse.getStatusCode() 200) {ListScanImageResponseBody.ScanImageResponseBodyDataResultsSubResults subResults scanImageResponse.body.data.results.get(0).getSubResults();ListIteratorScanImageResponseBody.ScanImageResponseBodyDataResultsSubResults listIterator subResults.listIterator();while (listIterator.hasNext()) {ScanImageResponseBody.ScanImageResponseBodyDataResultsSubResults item listIterator.next();System.out.println(scene [ item.scene ]);System.out.println(suggestion [ item.suggestion ]);System.out.println(label [ item.label ]);if (!item.suggestion.equals(pass)) {resultMap.put(suggestion, item.suggestion);resultMap.put(label, item.label);return resultMap;}}resultMap.put(suggestion, pass);} else {/* ** 表明请求整体处理失败原因视具体的情况详细分析*/System.out.println(the whole image scan request failed. response: JSON.toJSONString(scanImageResponse));return null;}} catch (com.aliyun.tea.TeaException teaException) {// 获取整体报错信息System.out.println(com.aliyun.teautil.Common.toJSONString(teaException));// 获取单个字段System.out.println(teaException.getCode());}return null;/* MapString, String resultMap new HashMap();resultMap.put(suggestion, pass);return resultMap;*/} } GreenTextScan代码 package com.heima.common.aliyun;import com.aliyun.imageaudit20191230.*; import com.aliyun.imageaudit20191230.models.ScanTextRequest; import com.aliyun.imageaudit20191230.models.ScanTextResponse; import com.aliyun.imageaudit20191230.models.ScanTextResponseBody; import com.aliyun.tea.TeaException; import com.aliyun.teaopenapi.models.Config; import com.aliyun.teautil.models.RuntimeOptions;import lombok.Getter; import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component;import java.util.*;Getter Setter Component ConfigurationProperties(prefix aliyun) public class GreenTextScan {private String accessKeyId;private String secret;public Map greeTextScan(String content) throws Exception {/*初始化配置对象com.aliyun.teaopenapi.models.ConfigConfig对象存放 AccessKeyId、AccessKeySecret、endpoint等配置*/Config config new Config().setAccessKeyId(accessKeyId).setAccessKeySecret(secret);// 访问的域名config.endpoint imageaudit.cn-shanghai.aliyuncs.com;Client client new Client(config);ScanTextRequest.ScanTextRequestTasks tasks new ScanTextRequest.ScanTextRequestTasks().setContent(content); //审核内容ScanTextRequest.ScanTextRequestLabels labels new ScanTextRequest.ScanTextRequestLabels().setLabel(abuse); //设置审核类型ScanTextRequest scanTextRequest new ScanTextRequest().setLabels(java.util.Arrays.asList(labels)).setTasks(java.util.Arrays.asList(tasks));RuntimeOptions runtime new com.aliyun.teautil.models.RuntimeOptions();MapString, String resultMap new HashMap();try {// 复制代码运行请自行打印API的返回值ScanTextResponse response client.scanTextWithOptions(scanTextRequest, runtime);//System.out.println(com.aliyun.teautil.Common.toJSONString(TeaModel.buildMap(response)));if (response.getStatusCode() 200) {ScanTextResponseBody.ScanTextResponseBodyDataElementsResults elementsResults response.body.getData().elements.get(0).results.get(0);if (!elementsResults.suggestion.equals(pass)) {resultMap.put(suggestion, elementsResults.suggestion);resultMap.put(label, elementsResults.label);return resultMap;}resultMap.put(suggestion, pass);return resultMap;} else {return null;}} catch (TeaException error) {// 获取整体报错信息System.out.println(com.aliyun.teautil.Common.toJSONString(error));// 获取单个字段System.out.println(error.getCode());error.printStackTrace();}return null;} } 添加到自动配置中 ② accessKeyId和secret需自己申请 在heima-leadnews-wemedia中的nacos配置中心添加以下配置 aliyun:accessKeyId: LTAI5tCWHCcfvqQzu8k2oKmXsecret: auoKUFsghimbfVQHpy7gtRyBkoR4vc #aliyun.scenesporn,terrorism,ad,qrcode,live,logoscenes: terrorism ③在自媒体微服务中测试类中注入审核文本和图片的bean进行测试 package com.heima.wemedia;import com.heima.common.aliyun.GreenImageScan; import com.heima.common.aliyun.GreenTextScan; import com.heima.file.service.FileStorageService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner;import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map;SpringBootTest(classes WemediaApplication.class) RunWith(SpringRunner.class) public class AliyunTest {Autowiredprivate GreenTextScan greenTextScan;Autowiredprivate GreenImageScan greenImageScan;Autowiredprivate FileStorageService fileStorageService;Testpublic void testScanText() throws Exception {Map map greenTextScan.greeTextScan(王天刚去饭店吃饭后发现自己的车子被刮了破口大骂是哪个傻逼干的);System.out.println(map);}Testpublic void testScanImage() throws Exception {ListString listnew ArrayList();list.add(http://192.168.200.130:9000/leadnews/2021/04/26/ef3cbe458db249f7bd6fb4339e593e55.jpg);Map map greenImageScan.imageScan(list);System.out.println(map);}} 结束
http://www.hkea.cn/news/14502448/

相关文章:

  • 最好的建站平台如何做网络推广赚钱
  • 必应网站提交入口帝国cms做电影网站
  • 做网站的顶部图片品牌营销与推广
  • 深圳招聘网站推荐提高工作效率图片
  • 网站转微信小程序云南建设局网站首页
  • 主题wordpress吉它多肉点击seo软件
  • 关于文化建设网站WordPress mip 评论框
  • 代码网站推荐专业的免费网站建设哪家
  • 高端网站改版锦州网站建设预订
  • wordpress网站导出porto 4wordpress下载
  • 可以进不良网站的浏览器服务类网站模板
  • 网站开发的公司排名推荐晚上用的网站
  • 网站模板代理电话云南省昆明市做网站的公司
  • 编程c++网课哪家好哈尔滨seo优化运营
  • 网络公司网站开发平面设计平台有哪些
  • 国家建设网站小制作怎么做
  • 网站开发岗位分析赞友商城电商平台排名第几
  • 个人是否可以做网站修改WordPress登陆
  • 重庆市官方网站手机网站建设的优势
  • 怎么把网页放到网站上网络公司最好的是哪个
  • 大庆网站制作公司地址电商发展趋势和未来
  • 德阳网站优化南昌寻南昌网站设计
  • 数据库网站开发价格成都专业网站建设套餐
  • 外国企业网站模板免费下载ios认证 东莞网站建设
  • 网站建设亿玛酷信赖apache 安装 wordpress
  • 大型网站建设培训课件如何建设网站挣钱
  • 动漫网站设计方案网站建设音乐插件怎么弄
  • 四川宜宾网站建设自己做网站转发新闻违法么
  • 长沙正规官网建站搜狗营销
  • 个人网站做论坛一么多设计公司