Update gradio demo
Browse files
README.md
CHANGED
|
@@ -80,10 +80,14 @@ $python3 gradio_demo.py
|
|
| 80 |
[INFO] SOC Name: AX650N
|
| 81 |
[INFO] VNPU type: VNPUType.DISABLED
|
| 82 |
[INFO] Compiler version: 4.2-dirty 5e72cf06-dirty
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
```
|
| 86 |
-
Then
|
| 87 |
|
| 88 |

|
| 89 |

|
|
|
|
| 80 |
[INFO] SOC Name: AX650N
|
| 81 |
[INFO] VNPU type: VNPUType.DISABLED
|
| 82 |
[INFO] Compiler version: 4.2-dirty 5e72cf06-dirty
|
| 83 |
+
|
| 84 |
+
==================================================
|
| 85 |
+
🌐 人脸修复工具 Web UI 已启动!
|
| 86 |
+
🔗 本地访问: http://127.0.0.1:7860
|
| 87 |
+
🔗 局域网访问: http://10.126.33.124:7860
|
| 88 |
+
==================================================
|
| 89 |
```
|
| 90 |
+
Then open the link in the terminal to access the web UI.
|
| 91 |
|
| 92 |

|
| 93 |

|
python/gradio_demo.py
CHANGED
|
@@ -5,6 +5,7 @@ import numpy as np
|
|
| 5 |
import axengine as axe
|
| 6 |
import cv2
|
| 7 |
from utils.restoration_helper import RestoreHelper
|
|
|
|
| 8 |
|
| 9 |
restore_helper = RestoreHelper(
|
| 10 |
upscale_factor=1,
|
|
@@ -199,5 +200,40 @@ with gr.Blocks(title="人脸修复工具") as demo:
|
|
| 199 |
)
|
| 200 |
|
| 201 |
# 启动
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
if __name__ == "__main__":
|
| 203 |
-
demo.launch(server_name="0.0.0.0", server_port=7860, theme=gr.themes.Soft()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
import axengine as axe
|
| 6 |
import cv2
|
| 7 |
from utils.restoration_helper import RestoreHelper
|
| 8 |
+
import socket
|
| 9 |
|
| 10 |
restore_helper = RestoreHelper(
|
| 11 |
upscale_factor=1,
|
|
|
|
| 200 |
)
|
| 201 |
|
| 202 |
# 启动
|
| 203 |
+
def get_local_ip():
|
| 204 |
+
"""获取本机局域网IP地址"""
|
| 205 |
+
try:
|
| 206 |
+
# 创建一个UDP连接(不会真正发送数据)
|
| 207 |
+
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
| 208 |
+
s.connect(("8.8.8.8", 80)) # 连接到公共DNS(Google)
|
| 209 |
+
ip = s.getsockname()[0]
|
| 210 |
+
return ip
|
| 211 |
+
except Exception:
|
| 212 |
+
# 回退到 localhost
|
| 213 |
+
return "127.0.0.1"
|
| 214 |
+
|
| 215 |
+
|
| 216 |
if __name__ == "__main__":
|
| 217 |
+
# demo.launch(server_name="0.0.0.0", server_port=7860, theme=gr.themes.Soft())
|
| 218 |
+
|
| 219 |
+
server_port = 7860
|
| 220 |
+
server_name = "0.0.0.0"
|
| 221 |
+
|
| 222 |
+
# 获取本机IP
|
| 223 |
+
local_ip = get_local_ip()
|
| 224 |
+
|
| 225 |
+
# 打印可点击的URL(大多数终端支持点击)
|
| 226 |
+
print("\n" + "="*50)
|
| 227 |
+
print("🌐 人脸修复工具 Web UI 已启动!")
|
| 228 |
+
print(f"🔗 本地访问: http://127.0.0.1:{server_port}")
|
| 229 |
+
if local_ip != "127.0.0.1":
|
| 230 |
+
print(f"🔗 局域网访问: http://{local_ip}:{server_port}")
|
| 231 |
+
print("="*50 + "\n")
|
| 232 |
+
|
| 233 |
+
# 启动Gradio应用
|
| 234 |
+
demo.launch(
|
| 235 |
+
server_name=server_name,
|
| 236 |
+
server_port=server_port,
|
| 237 |
+
theme=gr.themes.Soft(),
|
| 238 |
+
css=custom_css
|
| 239 |
+
)
|
python/utils/__pycache__/face_detector.cpython-313.pyc
CHANGED
|
Binary files a/python/utils/__pycache__/face_detector.cpython-313.pyc and b/python/utils/__pycache__/face_detector.cpython-313.pyc differ
|
|
|
python/utils/__pycache__/general.cpython-313.pyc
CHANGED
|
Binary files a/python/utils/__pycache__/general.cpython-313.pyc and b/python/utils/__pycache__/general.cpython-313.pyc differ
|
|
|
python/utils/__pycache__/restoration_helper.cpython-313.pyc
CHANGED
|
Binary files a/python/utils/__pycache__/restoration_helper.cpython-313.pyc and b/python/utils/__pycache__/restoration_helper.cpython-313.pyc differ
|
|
|