aaappp7878 commited on
Commit
c303ed7
·
verified ·
1 Parent(s): 7200c13

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -19
app.py CHANGED
@@ -173,30 +173,23 @@ def analyze_image_features(image):
173
  hsv = cv2.cvtColor(img_cv, cv2.COLOR_BGR2HSV)
174
  hue_std = float(np.std(hsv[:,:,0]))
175
  sat_std = float(np.std(hsv[:,:,1]))
176
- val_std = float(np.std(hsv[:,:,2ue_variation"] = hue 归一化
177
- features["saturation_variation"] = sat_std / 255 val_std / features
178
-
179
- def make_final_decision(ai_probability, image于AI概率和图像特征做出更准 基础 ai_probability >_decision = "高概率AI生 < 0.3:
180
- 类创作"
181
- else:
182
- base_decision = "无法确定"
183
 
184
  # 特征调整
185
  feature_score = 0
186
 
187
  # 检查对称性 - 高对称性通常表示AI生成
188
- if "horizontal_symmetry" in image_features and image_features["horizontal_symmetry"]0.1
189
  if "vertical_symmetry" in image_features and image_features["vertical_symmetry"] > 0.85:
190
-
191
-
192
- # 检查边缘 - AI生成图像通常边缘密_density"] < 0.010.1
193
-
194
- # 检查噪声 - AI生成图像通常噪声较低_level"] < 0.30.1
195
-
196
- # 检查颜色变化 - AI生成图像通常颜色变化更平滑 in image_features and image_features["hue_variation"] < 0.05
197
- if "saturation_variation" in image_features and image_features["saturation_variation"] < 0.10.1
198
-
199
- # 调整最终概率
200
  adjusted_probability = min(1.0, max(0.0, ai_probability + feature_score))
201
 
202
 
@@ -282,4 +275,4 @@ iface = gr.Interface(
282
  allow_flagging="never"
283
  )
284
 
285
- iface.launch()
 
173
  hsv = cv2.cvtColor(img_cv, cv2.COLOR_BGR2HSV)
174
  hue_std = float(np.std(hsv[:,:,0]))
175
  sat_std = float(np.std(hsv[:,:,1]))
176
+ val_std = float(np.std(hsv[:,:,2])) = hue_std /一化
177
+ features["saturation_variation"] =_variation"] = val_std /_final_decision(ai_probability, image率和图像特征做出更准确的决策策
178
+ if ai_probability > 0.7:
179
+ base_decision = "高概率AI生成"
180
+ elif ai_probability < 0.3:
181
+ base_decision = "高概率人类创作"
182
+
183
 
184
  # 特征调整
185
  feature_score = 0
186
 
187
  # 检查对称性 - 高对称性通常表示AI生成
188
+ if "horizontal_symmetry" in image_features and image_features["horizontal_symmetry"] > 0.850.1
189
  if "vertical_symmetry" in image_features and image_features["vertical_symmetry"] > 0.85:
190
+ # 检查边缘 - AI生成图像通常边缘密度较低_density"] < 0.01_score += 0.1 检查噪声 - AI生成图像通常噪声较低
191
+ "] < 0_score += 0.1 检查颜色变化 - AI生成图像通常颜色变化更ue_variation" in image_features and image_features["hue_variation"] < 0.05_score += uration_variation" in image_features and image_features["saturation_variation"] < _score += 0.1
192
+
 
 
 
 
 
 
 
193
  adjusted_probability = min(1.0, max(0.0, ai_probability + feature_score))
194
 
195
 
 
275
  allow_flagging="never"
276
  )
277
 
278
+ iface.launch()