Coder Social home page Coder Social logo

setuscore's Introduction

SetuScore

一个为色图打分的插件

更新

9.27 增加了卡通女性性感参数
开始打分时会有提示
调用api方式改为直接调用,不用再下载SDK,传图方式改为url 感谢@LHXnois
修改了一些小问题

9.26 添加了对data的检测
支持连续对话
新增回复打分选项

使用说明

https://cloud.baidu.com/product/imagecensoring 页面开通服务

开通后进入管理台创建应用 img

名称和描述随便填一下就行 img

记住你的Api Key, Secret Key,填入setu_score.py里对应的位置 img

开通图片审核服务,有免费一万次记得领一下,用完的话就往账号里存十块钱,够用很久了 img

进入 https://ai.baidu.com/censoring#/strategylist 页面创建策略 img

这里应用选你刚才创建那个 img

色情疑似区间拉满(这一步很重要!),然后在页面最下面保存策略 img img

把文件夹放入modules中并在__bot__.py中添加该插件

效果图: img

功能

指令 说明
打分 让机器人为图片打分

致谢

连续对话代码参考(嗯缝)了 https://github.com/pcrbot/picfinder_take

setuscore's People

Contributors

hmscygnet avatar lhxnois avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

setuscore's Issues

图片审核

请教一下,如果要把这个程序作为图片审核,只要发图就后台评分,凡是被定义为色图的就撤回消息,现在这个程序是使用了关键词作为触发,如果想达成我说的这种效果,应该用@sv.on_prefix 什么呢?对nonebot不太熟悉

直接使用api

百度云的验证不是很麻烦,不用必须下载sdk
这样的话就不需要额外安装依赖了
并且可以简单的使用异步方式来调用,减少阻塞
虽然想pr但是改起来好麻烦)贡献一些代码片段吧(大概没有错吧)
下面这段代码最终得到一个request_url,后续就用这个来调用api,headers是在调用时需要带上的请求头

client_id=‘’  #appkey
client_secret=‘’  #secretkey
host = f'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}'
response = requests.get(host)
access_token = response.json()["access_token"]
request_url = "https://aip.baidubce.com/rest/2.0/solution/v1/img_censor/v2/user_defined"
request_url = request_url + "?access_token=" + access_token
headers = {'content-type': 'application/x-www-form-urlencoded'}

api使用图片url的异步代码参考(推荐,因为简单)

from hoshino import aiorequests
async get_data(imgurl):
    params = {"imgUrl": imgurl}
    resp = await aiorequests.post(request_url, data=params, headers=headers)
    if resp.ok:
        data = await resp.json()
        print(data)

api使用图片base64的异步代码参考(未经测试)

from hoshino import aiorequests
import base64
async get_data(imgpath): #这个是全路径
    with open(filePath, 'rb') as fp:
        params = {"image": base64.b64encode(fp.read()).decode()}
    resp = await aiorequests.post(request_url, data=params, headers=headers)
    if resp.ok:
        data = await resp.json()
        print(data)

谢谢!

本来群里一个发色图的都没有,装了之后一天了色图都没断过。我的超人!

打分策略

好看的涩图不一定很涩 有没有办法从图片质量之类的方式一起来打分

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.