-
Notifications
You must be signed in to change notification settings - Fork 236
/
package.py
51 lines (41 loc) · 1.13 KB
/
package.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author: kerlomz <kerlomz@gmail.com>
import os
import cv2
import time
import stat
import socket
import paramiko
import platform
import distutils
import tensorflow as tf
tf.compat.v1.disable_v2_behavior()
from enum import Enum, unique
from utils import SystemUtils
from config import resource_path
from PyInstaller.__main__ import run, logger
""" Used to package as a single executable """
if platform.system() == 'Linux':
if distutils.distutils_path.endswith('__init__.py'):
distutils.distutils_path = os.path.dirname(distutils.distutils_path)
with open("./resource/VERSION", "w", encoding="utf8") as f:
today = time.strftime("%Y%m%d", time.localtime(time.time()))
f.write(today)
@unique
class Version(Enum):
CPU = 'CPU'
GPU = 'GPU'
if __name__ == '__main__':
ver = Version.CPU
upload = False
server_ip = ""
username = ""
password = ""
model_dir = "model"
graph_dir = "graph"
if ver == Version.GPU:
opts = ['tornado_server_gpu.spec', '--distpath=dist']
else:
opts = ['tornado_server.spec', '--distpath=dist']
run(opts)