Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
ad57895
1
Parent(s):
1a8b29b
init
Browse files
app.py
CHANGED
|
@@ -34,30 +34,30 @@ def edit_image_interface(input_image, prompt, request: gr.Request, progress=gr.P
|
|
| 34 |
country_info = get_country_info_safe(client_ip)
|
| 35 |
location_info = get_location_info_safe(client_ip)
|
| 36 |
|
| 37 |
-
# 检查IP是否因NSFW违规过多而被屏蔽 3
|
| 38 |
-
if client_ip in NSFW_Dict and NSFW_Dict[client_ip] >= 5:
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
|
| 62 |
if input_image is None:
|
| 63 |
return None, "Please upload an image first"
|
|
|
|
| 34 |
country_info = get_country_info_safe(client_ip)
|
| 35 |
location_info = get_location_info_safe(client_ip)
|
| 36 |
|
| 37 |
+
# # 检查IP是否因NSFW违规过多而被屏蔽 3
|
| 38 |
+
# if client_ip in NSFW_Dict and NSFW_Dict[client_ip] >= 5:
|
| 39 |
+
# print(f"❌ IP blocked due to excessive NSFW violations - IP: {client_ip}({country_info}), violations: {NSFW_Dict[client_ip]}")
|
| 40 |
|
| 41 |
+
# # 检查是否需要特殊处理(中文prompt或中国IP)
|
| 42 |
+
# has_chinese = contains_chinese(prompt.strip()) if prompt else False
|
| 43 |
+
# is_china_ip = location_info.get("country", "").lower() == "中国"
|
| 44 |
|
| 45 |
+
# if has_chinese or is_china_ip:
|
| 46 |
+
# # 构建特殊警告信息
|
| 47 |
+
# prov = location_info.get("prov", "未知省份")
|
| 48 |
+
# city = location_info.get("city", "未知城市")
|
| 49 |
+
# isp = location_info.get("isp", "Unknown")
|
| 50 |
|
| 51 |
+
# # 处理城市名称
|
| 52 |
+
# city_name = city.replace("市", "") if city != "未知城市" else "当地"
|
| 53 |
|
| 54 |
+
# # 处理ISP名称,去掉"中国"前缀
|
| 55 |
+
# isp_name = isp.replace("中国", "") if isp != "Unknown" else "未知"
|
| 56 |
|
| 57 |
+
# warning_msg = f"您的ip地址为{client_ip},地点为{prov}-{city},您的网络服务商为{isp_name},检测到您目前正在浏览,制作淫秽内容,已经上报给 {city_name}市公安局,已加急处理,请耐心等待警察上门调查"
|
| 58 |
+
# return None, f"❌ {warning_msg}"
|
| 59 |
+
# else:
|
| 60 |
+
# return None, f"❌ Your ip {client_ip},your region has been blocked for too much nsfw content"
|
| 61 |
|
| 62 |
if input_image is None:
|
| 63 |
return None, "Please upload an image first"
|