Module: AliyunGreen::Image
- Defined in:
- lib/aliyun_green/image.rb
Class Method Summary collapse
- .check_task_answer(task_ids) ⇒ Object
- .feedback ⇒ Object
- .scan(tasks, **options) ⇒ Object
- .scan_async(tasks, **options) ⇒ Object
- .scene_dict ⇒ Object
- .scene_response_dict ⇒ Object
Class Method Details
.check_task_answer(task_ids) ⇒ Object
24 25 26 |
# File 'lib/aliyun_green/image.rb', line 24 def check_task_answer(task_ids) response = AliyunGreen.client.post("/green/image/results", task_ids) end |
.feedback ⇒ Object
28 29 |
# File 'lib/aliyun_green/image.rb', line 28 def feedback end |
.scan(tasks, **options) ⇒ Object
4 5 6 7 8 |
# File 'lib/aliyun_green/image.rb', line 4 def scan(tasks, **) check_tasks(tasks) response = AliyunGreen.client.post("/green/image/scan", build_payload(tasks, )) response end |
.scan_async(tasks, **options) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/aliyun_green/image.rb', line 10 def scan_async(tasks, **) check_tasks(tasks) callback_url = [:callback_url] payload = build_payload(tasks, ) if callback_url payload[:callback] = callback_url payload[:seed] = SecureRandom.uuid end answer = AliyunGreen.client.post("/green/image/asyncscan", payload) answer["seed"] = payload[:seed] if callback_url answer end |
.scene_dict ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/aliyun_green/image.rb', line 31 def scene_dict { porn: "图片智能鉴黄", terrorism: "图片暴恐涉政", ad: "图文违规", qrcode: "图片二维码", live: "图片不良场景", logo: "图片logo", } end |
.scene_response_dict ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/aliyun_green/image.rb', line 42 def scene_response_dict { porn: { normal: "正常", sexy: "性感", porn: "色情", }, terrorism: { normal: "正常", bloody: "血腥", explosion: "爆炸烟光", outfit: "特殊装束", logo: "特殊标识", weapon: "武器", politics: "涉政", violence: "打斗", crowd: "聚众", parade: "游行", carcrash: "车祸现场", flag: "旗帜", location: "地标", drug: "涉毒", gamble: "赌博", others: "其他", }, ad: { normal: "正常", ad: "其他广告", politics: "文字含涉政内容", porn: "文字含涉黄内容", abuse: "文字含辱骂内容", terrorism: "文字含暴恐内容", contraband: "文字含违禁内容", spam: "文字含其他垃圾内容", npx: "牛皮癣广告", qrcode: "含二维码", programCode: "含小程序码", }, qrcode: { normal: "正常", qrcode: "含二维码", programCode: "含小程序码", }, live: { normal: "正常", meaningless: "图片中无内容(例如黑屏、白屏)", PIP: "画中画", smoking: "吸烟", drivelive: "车内直播", drug: "涉毒", gamble: "赌博", }, logo: { normal: "正常", TV: "含受管控的logo", trademark: "含商标", }, } end |