diff --git a/__pycache__/app.cpython-38.pyc b/__pycache__/app.cpython-38.pyc index 330c705..2282360 100644 Binary files a/__pycache__/app.cpython-38.pyc and b/__pycache__/app.cpython-38.pyc differ diff --git a/__pycache__/onnx_modifier.cpython-38.pyc b/__pycache__/onnx_modifier.cpython-38.pyc index 44fdafa..04fc9e0 100644 Binary files a/__pycache__/onnx_modifier.cpython-38.pyc and b/__pycache__/onnx_modifier.cpython-38.pyc differ diff --git a/app_desktop.py b/app_desktop.py new file mode 100644 index 0000000..5298e2c --- /dev/null +++ b/app_desktop.py @@ -0,0 +1,4 @@ +from flaskwebgui import FlaskUI +from app import app + +FlaskUI(app, width=1200, height=800).run() \ No newline at end of file diff --git a/static/index.js b/static/index.js index fb5ea9a..4d8a16d 100644 --- a/static/index.js +++ b/static/index.js @@ -354,6 +354,34 @@ host.BrowserHost = class { }); this._view.show('welcome'); + + + // informs flaskwebgui to keep server running while gui is running + // as illusrated in https://github.com/ClimenteA/flaskwebgui#install + // and here: https://stackoverflow.com/questions/39993676/code-inside-domcontentloaded-event-not-working + async function getRequest(url='') { + const response = await fetch(url, { + method: 'GET', + cache: 'no-cache' + }) + return response.json() + } + + if (this.document.readyState !== 'loading') { + console.log('document is already ready, just execute code here'); + + let url = this.document.location + let route = "/flaskwebgui-keep-server-alive" + let interval_request = 3 * 1000 //sec + + function keep_alive_server(){ + getRequest(url + route) + .then(data => console.log(data)) + } + + setInterval(keep_alive_server, interval_request) + } + } environment(name) { diff --git a/static/view.js b/static/view.js index 683db45..abce47d 100644 --- a/static/view.js +++ b/static/view.js @@ -66,6 +66,9 @@ view.View = class { container.addEventListener('touchstart', (e) => this._touchStartHandler(e), { passive: true }); break; } + + + }).catch((err) => { this.error(err, null, null); }); diff --git a/templates/index.html b/templates/index.html index 177bc21..ee12e1e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -9,6 +9,8 @@ + +