Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to identify and audit porn in batch in Python

Shulou Source: shulou.com Published: 2022-06-02 08:00:22 11月16日 Update

What this article shares with you is about how to identify and audit porn pictures in batches in Python. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Code import jsonfrom aip import AipImageCensorfrom multiprocessing.pool import ThreadPool

Checks = [] file_dumps = open (". / dump.txt", "w", encoding='utf-8')

Cur_count = 0global_count = 0

# here is the key you applied for above: APP_ID =''API_KEY =' 'SECRET_KEY =''

Def onetest (url): global cur_count try: client = AipImageCensor (APP_ID, API_KEY, SECRET_KEY) result = client.imageCensorUserDefined (url) result = json.loads (str (result). Replace ('" '") print (str (result) +"-{"+ str (cur_count) +" / "+ str (global_count) +"} ") if"' conclusionType': 1 "in str (result): file_dumps.write (url) cur_count = cur_count + 1 except Exception as e: print (e)

Def loaddata (): global global_count with open (". / urls.txt", "r", encoding='utf-8') as file: for line in file.readlines (): checks.append (line) global_count = len (checks)

Def main (): loaddata () pool = ThreadPool (processes=50) pool.map (onetest, checks) pool.close () pool.join ()

If _ _ name__ = ='_ _ main__': main ()

The above is how to identify and audit porn in batches in Python. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Identification that is more knowledge articles practical code keys work meetings articles read knowledge points industry details information information channels follow parts channels learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info NVidia Xiaomi Microsoft Linux