Spaces:
Running
Running
Commit
·
6ddb8bd
1
Parent(s):
1e477d8
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,23 @@
|
|
3 |
🎥 Video Content Safety Analysis - MiniGPT4-Video + 巨量引擎规则集成版
|
4 |
基于MiniGPT4-Video的真实视频内容分析 + 巨量引擎299条禁投规则检测
|
5 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
import os
|
7 |
import gradio as gr
|
8 |
import torch
|
@@ -30,22 +47,6 @@ from prohibited_rules import ProhibitedRulesEngine
|
|
30 |
# 设置中国镜像
|
31 |
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
|
32 |
|
33 |
-
# ZeroGPU装饰器
|
34 |
-
try:
|
35 |
-
import spaces
|
36 |
-
GPU_AVAILABLE = True
|
37 |
-
print("✅ ZeroGPU spaces 可用")
|
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
|
51 |
vis_processor = None
|
|
|
3 |
🎥 Video Content Safety Analysis - MiniGPT4-Video + 巨量引擎规则集成版
|
4 |
基于MiniGPT4-Video的真实视频内容分析 + 巨量引擎299条禁投规则检测
|
5 |
"""
|
6 |
+
|
7 |
+
# ZeroGPU装饰器 - 必须在torch等包之前导入!
|
8 |
+
try:
|
9 |
+
import spaces
|
10 |
+
GPU_AVAILABLE = True
|
11 |
+
print("✅ ZeroGPU spaces 可用")
|
12 |
+
except ImportError:
|
13 |
+
print("⚠️ ZeroGPU spaces 不可用,使用CPU模式")
|
14 |
+
GPU_AVAILABLE = False
|
15 |
+
# 创建一个空的装饰器
|
16 |
+
class spaces:
|
17 |
+
@staticmethod
|
18 |
+
def GPU(duration=60):
|
19 |
+
def decorator(func):
|
20 |
+
return func
|
21 |
+
return decorator
|
22 |
+
|
23 |
import os
|
24 |
import gradio as gr
|
25 |
import torch
|
|
|
47 |
# 设置中国镜像
|
48 |
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
# 全局变量
|
51 |
model = None
|
52 |
vis_processor = None
|