Windows exe is created

1123
ZhangGe6 4 years ago
parent c269500e8c
commit 30324c1c2e

16
.gitignore vendored

@ -1,8 +1,16 @@
# tmp files
*/__pycache__/
gym/
*ppt
*pptx
build/
dist/
*.spec
# onnx files
*.onnx
/test_onnx/
/modified_onnx/
/modified_onnx/
# self maintained files
gym/
*ppt
*pptx

@ -1,4 +1,33 @@
import sys
sys.path.append("../../")
from flaskwebgui import FlaskUI
from app import app
FlaskUI(app, width=1200, height=800).run()
FlaskUI(app, maximized=True, idle_interval=1).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 index.js
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
'''

@ -2,6 +2,8 @@
English | [简体中文](readme_zh-CN.md)
> In this branch
# Introduction
To edit an ONNX model, One common way is to visualize the model graph, and edit it using ONNX Python API. This works fine. However, we have to code to edit, then visualize to check. The two processes may iterate for many times, which is time-consuming. 👋
@ -27,6 +29,9 @@ Hope it helps!
# Getting started
We have two methods to launch `onnx-modifier` now.
## launch from command line
Clone the repo and install the required Python packages by
```bash
@ -45,6 +50,13 @@ python app.py
Click the url in the output info generated by flask (`http://127.0.0.1:5000/` for example), then `onnx-modifier` will be launched in the web browser.
## launch from executable file
- Windows: Download [onnx-modifier.exe](https://drive.google.com/file/d/1y7mYlvF0G5iiNDgOFh1ESXlTs8I2ipVQ/view?usp=sharing), double-click it and enjoy.
- Egde browser is used for viewing by default.
> I recorded how I made the the executable file in `app_desktop.py`. The executable file for other platforms are left for future work.
Click `Open Model...` to upload the ONNX model to edit. The model will be parsed and shown on the page.
# Usage
@ -145,7 +157,7 @@ For quick testing, some typical sample models are provided as following. Most of
- [ ] Create executable file for easier launching for the following platforms:
- [ ] Linux
- [ ] Windows
- [x] Windows
- [ ] Add `merge models` feature
# Credits and referred materials
@ -157,3 +169,4 @@ For quick testing, some typical sample models are provided as following. Most of
- ONNX IO Stream [Leimao's Blog](https://leimao.github.io/blog/ONNX-IO-Stream/)
- [onnx-utils](https://github.com/saurabh-shandilya/onnx-utils)
- [sweetalert](https://github.com/t4t5/sweetalert)
- [flaskwebgui](https://github.com/ClimenteA/flaskwebgui)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

@ -372,11 +372,13 @@ host.BrowserHost = class {
let url = this.document.location
let route = "/flaskwebgui-keep-server-alive"
let interval_request = 3 * 1000 //sec
// let interval_request = 3 * 1000 //sec
let interval_request = 0.5 * 1000 //sec
function keep_alive_server(){
getRequest(url + route)
.then(data => console.log(data))
.then(data => {})
// .then(data => console.log(data))
}
setInterval(keep_alive_server, interval_request)

Loading…
Cancel
Save