mirror of
https://github.com/Zeyi-Lin/HivisionIDPhotos.git
synced 2025-09-15 14:58:34 +08:00
feat: convert gradio app into .exe executable file
This commit is contained in:
parent
ddc8c21f24
commit
961bf2e35f
5
.gitignore
vendored
5
.gitignore
vendored
@ -3,4 +3,7 @@
|
||||
.idea
|
||||
.DS_Store
|
||||
hivision_modnet.onnx
|
||||
output/*.jpg
|
||||
output/*.jpg
|
||||
# build outputs
|
||||
dist
|
||||
build
|
||||
|
||||
6
app.py
6
app.py
@ -1,3 +1,4 @@
|
||||
import os
|
||||
import gradio as gr
|
||||
import onnxruntime
|
||||
from src.face_judgement_align import IDphotos_create
|
||||
@ -226,7 +227,8 @@ def idphoto_inference(
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 预加载 ONNX 模型
|
||||
HY_HUMAN_MATTING_WEIGHTS_PATH = "./hivision_modnet.onnx"
|
||||
root_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
HY_HUMAN_MATTING_WEIGHTS_PATH = os.path.join(root_dir, "hivision_modnet.onnx")
|
||||
sess = onnxruntime.InferenceSession(HY_HUMAN_MATTING_WEIGHTS_PATH)
|
||||
|
||||
size_mode = ["尺寸列表", "只换底", "自定义尺寸"]
|
||||
@ -319,7 +321,7 @@ if __name__ == "__main__":
|
||||
components=[img_input],
|
||||
samples=[
|
||||
[path.as_posix()]
|
||||
for path in sorted(pathlib.Path("images").rglob("*.jpg"))
|
||||
for path in sorted(pathlib.Path(os.path.join(root_dir, "images")).rglob("*.jpg"))
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
44
app.spec
Normal file
44
app.spec
Normal file
@ -0,0 +1,44 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
from PyInstaller.utils.hooks import collect_data_files
|
||||
|
||||
datas = [('hivisionai', 'hivisionai'), ('hivision_modnet.onnx', '.')]
|
||||
datas += collect_data_files('gradio_client')
|
||||
datas += collect_data_files('gradio')
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['app.py'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=datas,
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='HivisionIDPhotos',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=True,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
icon=['assets\hivisionai.ico'],
|
||||
)
|
||||
BIN
assets/hivisionai.ico
Normal file
BIN
assets/hivisionai.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Loading…
Reference in New Issue
Block a user