Prechádzať zdrojové kódy

AI混合使用识别模型

zhangdongming 1 týždeň pred
rodič
commit
e17eb32fc8
1 zmenil súbory, kde vykonal 8 pridanie a 6 odobranie
  1. 8 6
      Controller/AiController.py

+ 8 - 6
Controller/AiController.py

@@ -148,8 +148,10 @@ class AiView(View):
             if AiServiceQuery[0]['orders__payType'] == 10:  # AI首次体验前半个月调Rekognition
                 now_time = int(time.time())
                 add_time = AiServiceQuery[0]['addTime']
-                if (now_time - add_time) <= (3600 * 24 * 3):
+                if (now_time - add_time) <= (3600 * 24 * 2):
                     ai_server = 'rekognition'
+                elif (now_time - add_time) <= (3600 * 24 * 3):
+                    ai_server = 'novaLite'
 
             APP_NOTIFY_KEY = f'ASJ:NOTIFY:PUSH:{uid}:{channel}'  # 推送间隔缓存KEY
             push_cache_data = redis_obj.get_data(APP_NOTIFY_KEY)
@@ -159,9 +161,9 @@ class AiView(View):
 
             # APP推送提醒状态
             notify = self.is_ai_push(uid, notify_data) if is_push else is_push
-            nova_key = f'PUSH:NOVA:LITE:{uid}'
-            nova = redis_obj.get_data(nova_key)
-            if nova:  # AWS AI模型
+            # nova_key = f'PUSH:NOVA:LITE:{uid}'
+            # nova = redis_obj.get_data(nova_key)
+            if ai_server == 'novaLite':  # AWS AI模型
                 sage_maker = SageMakerAiObject()
 
                 # AI nova识别异步存表&推送
@@ -279,8 +281,8 @@ class AiView(View):
 
             client = boto3.client(
                 'rekognition',
-                aws_access_key_id='AKIA2E67UIMD6JD6TN3J',
-                aws_secret_access_key='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',
+                aws_access_key_id=AWS_ACCESS_KEY_ID[1],
+                aws_secret_access_key=AWS_SECRET_ACCESS_KEY[1],
                 region_name='us-east-1')
             # 执行AWS Rekognition:
             rekognition_res = client.detect_labels(