Parcourir la source

未识别出的图不删除

lang il y a 3 ans
Parent
commit
33dba34181
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      Controller/AiController.py

+ 5 - 1
Controller/AiController.py

@@ -176,6 +176,9 @@ class AiView(View):
             labels = self.labelsCoords(detect_group, rekognition_res, image_size, n_time)    #检查标签是否符合用户选择的识别类型
             # return response.json(0,labels)
             if len(labels['label_list']) == 0:
+                # 需要删除图片
+                # photo.close()
+                # self.del_path(os.path.join(BASE_DIR, 'static/ai/' + uid))
                 logger.info('没有识别到任何标签-----------------')
                 return response.json(10055)
             event_type_list = labels['user_detect_group']
@@ -192,7 +195,8 @@ class AiView(View):
                 thread_task.start()
             #需要删除图片
             photo.close()
-            # self.del_path(os.path.join(BASE_DIR, 'static/ai/' + uid))
+            self.del_path(dir_path)
+            self.del_path(dir_path + '.jpg')
 
             #存储消息以及推送
             is_st = 3  #多图