-
Notifications
You must be signed in to change notification settings - Fork 170
/
app_desktop.py
39 lines (31 loc) · 1.62 KB
/
app_desktop.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
import os
import sys
sys.path.append("../../")
try:
from flaskwebgui import FlaskUI
except ModuleNotFoundError:
os.system("pip install flaskwebgui==0.3.5")
from flaskwebgui import FlaskUI
from app import app
FlaskUI(app, maximized=True, idle_interval=5).run()
'''
This script is used for generating excutable files.
The following are some notes about How I worked for it.
1. How to make flaskwebgui work as expected:
a. install flaskwebgui: `pip install flaskwebgui`
- flaskwebgui github repo: https://github.com/ClimenteA/flaskwebgui
b. add some scripts to keep server running while gui is running
- see here: https://github.com/ClimenteA/flaskwebgui#install
- I added the code in the static/index.js (find "keep_alive_server()")
c. Then run: `python app_desktop.py`, the web browser will be automatically lauched for onnx-modifier
2. How to generate excutable files:
a. For Windows:
- Run `pyinstaller -F -n onnx-modifier -i ./static/favicon.png --add-data "templates;templates" --add-data "static;static" app_desktop.py`
- see here: https://stackoverflow.com/a/48976223/10096987
- Then we can find the our target `.exe` file in the ./dist folder.
- The icon will not show until we change it in another directory due to Windows Explorer caching.
- see here: https://stackoverflow.com/a/35783199/10096987
b. For Ubuntu (not done):
- Run `pyinstaller -F -n onnx-modifier -i ./static/favicon.png --add-data "templates:templates" --add-data "static:static" app_desktop.py`
- However, I get a file with size of 400+MB
'''