Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to identify and audit porn in batch in Python

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report