Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ for key in models:
|
|
41 |
|
42 |
## 2. 模型输出处理
|
43 |
|
44 |
-
|
45 |
def process_model_output(model_info, outputs, probabilities):
|
46 |
"""处理不同模型的输出,统一返回AI生成概率"""
|
47 |
model_name = model_info["name"].lower()
|
@@ -115,7 +115,7 @@ def process_model_output(model_info, outputs, probabilities):
|
|
115 |
|
116 |
## 3. 图像特征分析
|
117 |
|
118 |
-
|
119 |
def analyze_image_features(image):
|
120 |
"""分析图像特征"""
|
121 |
# 转换为OpenCV格式
|
@@ -214,7 +214,7 @@ def analyze_image_features(image):
|
|
214 |
|
215 |
## 4. AI特征检查
|
216 |
|
217 |
-
|
218 |
def check_ai_specific_features(image_features):
|
219 |
"""检查AI生成图像的典型特征"""
|
220 |
ai_score = 0
|
@@ -260,7 +260,7 @@ def check_ai_specific_features(image_features):
|
|
260 |
|
261 |
## 5. PS痕迹检测
|
262 |
|
263 |
-
|
264 |
def detect_photoshop_signs(image_features):
|
265 |
"""检测图像中的PS痕迹"""
|
266 |
ps_score = 0
|
@@ -317,7 +317,7 @@ def detect_photoshop_signs(image_features):
|
|
317 |
|
318 |
## 6. 结果分析与分类
|
319 |
|
320 |
-
|
321 |
def get_detailed_analysis(ai_probability, ps_score, ps_signs, ai_signs, valid_models_count):
|
322 |
"""提供更详细的分析结果"""
|
323 |
|
@@ -379,7 +379,7 @@ def get_detailed_analysis(ai_probability, ps_score, ps_signs, ai_signs, valid_mo
|
|
379 |
|
380 |
## 7. 主检测函数
|
381 |
|
382 |
-
|
383 |
def detect_ai_image(image):
|
384 |
"""主检测函数"""
|
385 |
if image is None:
|
@@ -494,7 +494,7 @@ def detect_ai_image(image):
|
|
494 |
|
495 |
## 8. Gradio界面
|
496 |
|
497 |
-
|
498 |
# 创建Gradio界面
|
499 |
iface = gr.Interface(
|
500 |
fn=detect_ai_image,
|
|
|
41 |
|
42 |
## 2. 模型输出处理
|
43 |
|
44 |
+
|
45 |
def process_model_output(model_info, outputs, probabilities):
|
46 |
"""处理不同模型的输出,统一返回AI生成概率"""
|
47 |
model_name = model_info["name"].lower()
|
|
|
115 |
|
116 |
## 3. 图像特征分析
|
117 |
|
118 |
+
|
119 |
def analyze_image_features(image):
|
120 |
"""分析图像特征"""
|
121 |
# 转换为OpenCV格式
|
|
|
214 |
|
215 |
## 4. AI特征检查
|
216 |
|
217 |
+
|
218 |
def check_ai_specific_features(image_features):
|
219 |
"""检查AI生成图像的典型特征"""
|
220 |
ai_score = 0
|
|
|
260 |
|
261 |
## 5. PS痕迹检测
|
262 |
|
263 |
+
|
264 |
def detect_photoshop_signs(image_features):
|
265 |
"""检测图像中的PS痕迹"""
|
266 |
ps_score = 0
|
|
|
317 |
|
318 |
## 6. 结果分析与分类
|
319 |
|
320 |
+
|
321 |
def get_detailed_analysis(ai_probability, ps_score, ps_signs, ai_signs, valid_models_count):
|
322 |
"""提供更详细的分析结果"""
|
323 |
|
|
|
379 |
|
380 |
## 7. 主检测函数
|
381 |
|
382 |
+
|
383 |
def detect_ai_image(image):
|
384 |
"""主检测函数"""
|
385 |
if image is None:
|
|
|
494 |
|
495 |
## 8. Gradio界面
|
496 |
|
497 |
+
|
498 |
# 创建Gradio界面
|
499 |
iface = gr.Interface(
|
500 |
fn=detect_ai_image,
|