zhangyong 6 months ago
parent
commit
10c5c1f6f8
3 changed files with 4 additions and 4 deletions
  1. 1 1
      analyze_video.py
  2. 1 1
      google_ai/generativeai_video.py
  3. 2 2
      job_video_processing.py

+ 1 - 1
analyze_video.py

@@ -51,7 +51,7 @@ async def process_video(request: VideoRequest):
     api_key_index = (api_key_index + 1) % len(api_keys)
     try:
         print("来一个请求,使用 API key:", api_key)
-        result = await main(video_path, api_key, prompt, mark, sample_data)
+        result = await main(video_path, api_key, prompt, sample_data)
         return {
             "code": 0,
             "message": "视频处理成功",

+ 1 - 1
google_ai/generativeai_video.py

@@ -129,7 +129,7 @@ class VideoAnalyzer:
             return int(duration)
         return 0
 
-async def main(video_path, api_key, prompt, mark, sample_data):
+async def main(video_path, api_key, prompt, sample_data):
     """主函数,执行视频上传、缓存创建、问题生成"""
     attempt = 0
     max_attempts = 1

+ 2 - 2
job_video_processing.py

@@ -2,11 +2,11 @@ import time
 from concurrent.futures import ThreadPoolExecutor
 from video_processing.video_processing import VideoProcessing
 
-max_workers = 5  # 最大线程数
+max_workers = 2  # 最大线程数
 
 
 def video_ai_task_start():
-    redis_task_list = ['task:video_ai_top', 'task:video_ai_top', 'task:video_ai_recommend', 'task:video_ai_recommend', 'task:video_ai_recommend']
+    redis_task_list = ['task:video_ai_recommend', 'task:video_ai_recommend', 'task:video_ai_recommend', 'task:video_ai_top', 'task:video_ai_top']
     futures = []  # 用来存储任务的 Future 对象
     task_index = 0