weiyi01191 commited on
Commit
c49cd13
·
1 Parent(s): 7e190cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -38,10 +38,13 @@ try:
38
  except ImportError:
39
  print("⚠️ ZeroGPU spaces 不可用,使用CPU模式")
40
  GPU_AVAILABLE = False
 
41
  class spaces:
42
  @staticmethod
43
- def GPU(func):
44
- return func
 
 
45
 
46
  # 全局变量
47
  model = None
@@ -433,7 +436,7 @@ def load_minigpt4_model():
433
  print("🔄 回退到模拟模式...")
434
  return None, None, None
435
 
436
- @spaces.GPU if GPU_AVAILABLE else lambda f: f
437
  def analyze_video_with_minigpt4(video_file, instruction):
438
  """使用MiniGPT4-Video分析视频内容并进行巨量引擎规则检测"""
439
  if video_file is None:
 
38
  except ImportError:
39
  print("⚠️ ZeroGPU spaces 不可用,使用CPU模式")
40
  GPU_AVAILABLE = False
41
+ # 创建一个空的装饰器
42
  class spaces:
43
  @staticmethod
44
+ def GPU(duration=60):
45
+ def decorator(func):
46
+ return func
47
+ return decorator
48
 
49
  # 全局变量
50
  model = None
 
436
  print("🔄 回退到模拟模式...")
437
  return None, None, None
438
 
439
+ @spaces.GPU(duration=120)
440
  def analyze_video_with_minigpt4(video_file, instruction):
441
  """使用MiniGPT4-Video分析视频内容并进行巨量引擎规则检测"""
442
  if video_file is None: