[![NPM version](https://badge.fury.io/js/cdk-image-moderation.svg)](https://badge.fury.io/js/cdk-image-moderation)
[![PyPI version](https://badge.fury.io/py/cdk-image-moderation.svg)](https://badge.fury.io/py/cdk-image-moderation)
[![Release](https://github.com/pahud/cdk-image-moderation/actions/workflows/release.yml/badge.svg)](https://github.com/pahud/cdk-image-moderation/actions/workflows/release.yml)
# cdk-image-moderation
Event-driven image moderation and notification service with AWS CDK
![](images/cdk-image-moderation2.svg)
# Sample
This sample create a S3 bucket that will trigger image moderation check on object created and send notification to SNS when specific moderation labels are detected. The `SNS2Telegram` creates a Lambda function as the SNS topic subscription which fires the notification to a private Telegram chatroom with the image preview and moderation result.
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from cdk_image_moderation import Moderation, SNS2Telegram
app = cdk.App()
env = {
"region": process.env.CDK_DEFAULT_REGION,
"account": process.env.CDK_DEFAULT_ACCOUNT
}
stack = cdk.Stack(app, "moderation-demo", env=env)
# create the moderation
mod = Moderation(stack, "Mod",
moderation_labels=[ModerationLabels.EXPLICIT_NUDITY, ModerationLabels.DRUGS, ModerationLabels.TOBACCO, ModerationLabels.ALCOHOL, ModerationLabels.VIOLENCE, ModerationLabels.RUDE_GESTURES
]
)
# send notification via sns to telegram
SNS2Telegram(stack, "SNS2TG",
topic=mod.topic,
chatid="-547476398"
)
```
# Deploy the CDK app
```sh
export TELEGRAM_TOKEN=<YOUR_TOKEN>
cdk diff
cdk deploy
```
# Deploy from this repository
```sh
export TELEGRAM_TOKEN=<YOUR_TOKEN>
# run `yarn build` or `yarn watch` to generate the lib
cdk --app lib/integ.default.js diff
cdk --app lib/integ.default.js deploy
```
On deploy completed, you will get the S3 bucket in the `Outputs`. Simply upload any images into this bucket and you should be able to get the notification from the Telegram chatroom.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共16个文件
txt:4个
py:3个
pkg-info:2个
资源分类:Python库 所属语言:Python 资源全名:cdk-image-moderation-0.1.87.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源详情
资源评论
资源推荐
收起资源包目录
cdk-image-moderation-0.1.87.tar.gz (16个子文件)
cdk-image-moderation-0.1.87
MANIFEST.in 23B
PKG-INFO 3KB
pyproject.toml 106B
LICENSE 11KB
src
cdk_image_moderation.egg-info
PKG-INFO 3KB
requires.txt 349B
SOURCES.txt 474B
top_level.txt 21B
dependency_links.txt 1B
cdk_image_moderation
setup.cfg 38B
setup.py 2KB
README.md 2KB
共 16 条
- 1
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0