Browse Source

AI识别增加调试代码

zhangdongming 1 year ago
parent
commit
94ebacacf5
1 changed files with 13 additions and 6 deletions
  1. 13 6
      Controller/AiController.py

+ 13 - 6
Controller/AiController.py

@@ -28,13 +28,14 @@ from Model.models import UidPushModel, AiService, VodHlsTag, VodHlsTagType
 from Object import MergePic
 from Object import MergePic
 from Object.DynamodbObject import DynamodbObject
 from Object.DynamodbObject import DynamodbObject
 from Object.ETkObject import ETkObject
 from Object.ETkObject import ETkObject
-from Object.RedisObject import RedisObject
 from Object.ResponseObject import ResponseObject
 from Object.ResponseObject import ResponseObject
 from Object.SageMakerAiObject import SageMakerAiObject
 from Object.SageMakerAiObject import SageMakerAiObject
 from Object.TokenObject import TokenObject
 from Object.TokenObject import TokenObject
 from Object.enums.MessageTypeEnum import MessageTypeEnum
 from Object.enums.MessageTypeEnum import MessageTypeEnum
 from Service.CommonService import CommonService
 from Service.CommonService import CommonService
 from Service.EquipmentInfoService import EquipmentInfoService
 from Service.EquipmentInfoService import EquipmentInfoService
+from Object.RedisObject import RedisObject
+import threading
 
 
 TIME_LOGGER = logging.getLogger('time')
 TIME_LOGGER = logging.getLogger('time')
 
 
@@ -101,11 +102,6 @@ class AiView(View):
             file_post_three = request_dict.get('fileThree', None)
             file_post_three = request_dict.get('fileThree', None)
             TIME_LOGGER.info(f'uid:{uid},图1:{file_post_one[:30]},图2:{file_post_two[:30]},图3:{file_post_three[:30]}')
             TIME_LOGGER.info(f'uid:{uid},图1:{file_post_one[:30]},图2:{file_post_two[:30]},图3:{file_post_three[:30]}')
 
 
-            if uid == 'JTH5YA2KT6XRY74T111A':
-                redis = RedisObject(6)
-                params = f'picture1={file_post_one[:30]},picture2={file_post_two[:30]},picture3={file_post_three[:30]}'
-                redis.set_data(f'ASJ:PUSH:{uid}:{n_time}', val=params, expire=300)
-
             file_list = [file_post_one, file_post_two, file_post_three]
             file_list = [file_post_one, file_post_two, file_post_three]
             del file_post_one, file_post_two, file_post_three
             del file_post_one, file_post_two, file_post_three
             if not all(file_list):
             if not all(file_list):
@@ -134,6 +130,17 @@ class AiView(View):
             if ai_server == 'sageMaker':  # 自建模型sageMaker AI
             if ai_server == 'sageMaker':  # 自建模型sageMaker AI
                 sage_maker = SageMakerAiObject()
                 sage_maker = SageMakerAiObject()
                 ai_result = sage_maker.sage_maker_ai_server(uid, file_list)  # 图片base64识别AI标签
                 ai_result = sage_maker.sage_maker_ai_server(uid, file_list)  # 图片base64识别AI标签
+
+                if uid == 'JTH5YA2KT6XRY74T111A':
+                    redis = RedisObject(6)
+                    params = f'result{ai_result}'
+                    redis.set_data(f'ASJ:PUSH:{uid}:{n_time}', val=params, expire=1800)
+                    push_thread = threading.Thread(target=SageMakerAiObject().upload_image_to_s3,
+                                                   kwargs={'uid': uid, 'channel': channel,
+                                                           'd_push_time': int('8' + n_time),
+                                                           'file_list': file_list})
+                    push_thread.start()  # APP消息提醒异步推送
+
                 if ai_result:
                 if ai_result:
                     res = sage_maker.get_table_name(uid, ai_result, AiServiceQuery[0]['detect_group'])
                     res = sage_maker.get_table_name(uid, ai_result, AiServiceQuery[0]['detect_group'])
                     if not res:
                     if not res: