Spaces:
Running
Running
Commit
·
c94174a
1
Parent(s):
009432d
init
Browse files
app.py
CHANGED
|
@@ -138,32 +138,32 @@ def edit_image_interface(input_image, prompt, request: gr.Request, progress=gr.P
|
|
| 138 |
# 记录NSFW检测
|
| 139 |
record_nsfw_detection(client_ip)
|
| 140 |
|
| 141 |
-
# 检查是否需要特殊处理(中文prompt或中国IP)
|
| 142 |
-
has_chinese = contains_chinese(prompt.strip())
|
| 143 |
-
is_china_ip = location_info.get("country", "").lower() == "中国"
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
isp = location_info.get("isp", "Unknown")
|
| 150 |
|
| 151 |
-
|
| 152 |
-
|
| 153 |
|
| 154 |
-
|
| 155 |
-
|
| 156 |
|
| 157 |
-
|
| 158 |
|
| 159 |
-
|
| 160 |
-
|
| 161 |
|
| 162 |
-
|
| 163 |
-
else:
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
|
|
|
| 167 |
|
| 168 |
except Exception as e:
|
| 169 |
print(f"⚠️ NSFW检测失败: {e}")
|
|
|
|
| 138 |
# 记录NSFW检测
|
| 139 |
record_nsfw_detection(client_ip)
|
| 140 |
|
| 141 |
+
# # 检查是否需要特殊处理(中文prompt或中国IP)
|
| 142 |
+
# has_chinese = contains_chinese(prompt.strip())
|
| 143 |
+
# is_china_ip = location_info.get("country", "").lower() == "中国"
|
| 144 |
+
# if has_chinese or is_china_ip:
|
| 145 |
+
# # 构建特殊警告信息
|
| 146 |
+
# prov = location_info.get("prov", "未知省份")
|
| 147 |
+
# city = location_info.get("city", "未知城市")
|
| 148 |
+
# isp = location_info.get("isp", "Unknown")
|
|
|
|
| 149 |
|
| 150 |
+
# # 处理城市名称
|
| 151 |
+
# city_name = city.replace("市", "") if city != "未知城市" else "当地"
|
| 152 |
|
| 153 |
+
# # 处理ISP名称,去掉"中国"前缀
|
| 154 |
+
# isp_name = isp.replace("中国", "") if isp != "Unknown" else "未知"
|
| 155 |
|
| 156 |
+
# warning_msg = f"您的ip地址为{client_ip},地点为{prov}-{city},您的网络服务商为{isp_name},检测到您目前正在浏览,制作淫秽内容,已经上报给 {city_name}市公安局,已加急处理,请耐心等待警察上门调查"
|
| 157 |
|
| 158 |
+
# print(f"⚠️ 特殊NSFW警告 - IP: {client_ip}, 位置: {prov}-{city}, ISP: {isp_name}, 中文Prompt: {has_chinese}, 中国IP: {is_china_ip}")
|
| 159 |
+
# print(warning_msg)
|
| 160 |
|
| 161 |
+
# return None, f"❌ {warning_msg}"
|
| 162 |
+
# else:
|
| 163 |
+
# # 常规NSFW提示
|
| 164 |
+
# print(f"❌ NSFW image detected - IP: {client_ip}({country_info}), violations: {NSFW_Dict[client_ip]}")
|
| 165 |
+
# return None, f"❌ Your ip {client_ip},your region has been blocked for too much nsfw content"
|
| 166 |
+
|
| 167 |
|
| 168 |
except Exception as e:
|
| 169 |
print(f"⚠️ NSFW检测失败: {e}")
|