TheHamkerCat / SpamProtectionRobot

Anti Spam/NSFW Telegram Bot Written In Python With Pyrogram.
https://t.me/SpamProtectionRobot
MIT License
67 stars 122 forks source link

Support for custom NSFW api #3

Closed devillD closed 2 years ago

devillD commented 2 years ago

Kindly add support for custom NSFW API users. I wanna test a different model for the NSFW project. It would be very helpful. Thank you

TheHamkerCat commented 2 years ago

Custom NSFW API? this project uses python-arq, which is a wrapper for ARQ API, and ARQ uses https://github.com/GantMan/nsfw_model/ underneath

devillD commented 2 years ago

Check this: https://api-devilld.cloud.okteto.net/?url=https://i.ibb.co/tmFJdwy/model.jpg I deployed that with your repo though. But the model is https://index-production.up.railway.app/nsfw_model_224x224_10MB.h5 Where, your default model is https://index-production.up.railway.app/nsfw_model_299x299_151MB.h5

TheHamkerCat commented 2 years ago

Check this: https://api-devilld.cloud.okteto.net/?url=https://i.ibb.co/tmFJdwy/model.jpg I deployed that with your repo though. But the model is https://index-production.up.railway.app/nsfw_model_224x224_10MB.h5 Where, your default model is https://index-production.up.railway.app/nsfw_model_299x299_151MB.h5

Well, if you want to change the model/API that the bot is using or you want to use something custom, you can do it with a little change, just replace things like https://github.com/TheHamkerCat/SpamProtectionRobot/blob/03cad607d4c613d9fe4facd0ec5e202a43cc9991/spr/modules/watcher.py#L59 and https://github.com/TheHamkerCat/SpamProtectionRobot/blob/03cad607d4c613d9fe4facd0ec5e202a43cc9991/spr/modules/watcher.py#L76 with your own API request, make sure the response is completely same, then convert the response json to dotmap and everything should work as expected

devillD commented 2 years ago

Got it! Thank you so much.