mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-08-22 22:34:25 -07:00
Quit from brower
This commit is contained in:
parent
3bf36b4671
commit
aab3eee539
1 changed files with 22 additions and 22 deletions
|
@ -319,34 +319,33 @@ def create_flask_app(s2c, c2s, s2flask, args):
|
||||||
yield frame
|
yield frame
|
||||||
yield b'\r\n\r\n'
|
yield b'\r\n\r\n'
|
||||||
|
|
||||||
|
def send(queue, op):
|
||||||
|
queue.put({'op': op})
|
||||||
|
|
||||||
|
def send_and_wait(queue, op):
|
||||||
|
while not s2flask.empty():
|
||||||
|
s2flask.get()
|
||||||
|
queue.put({'op': op})
|
||||||
|
while s2flask.empty():
|
||||||
|
pass
|
||||||
|
s2flask.get()
|
||||||
|
|
||||||
@app.route('/', methods=['GET', 'POST'])
|
@app.route('/', methods=['GET', 'POST'])
|
||||||
def index():
|
def index():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if 'save' in request.form:
|
if 'save' in request.form:
|
||||||
s2c.put({'op': 'save'})
|
send(s2c, 'save')
|
||||||
|
return '', 204
|
||||||
elif 'exit' in request.form:
|
elif 'exit' in request.form:
|
||||||
s2c.put({'op': 'close'})
|
send(c2s, 'close')
|
||||||
|
request.environ.get('werkzeug.server.shutdown')()
|
||||||
|
return '', 204
|
||||||
elif 'update' in request.form:
|
elif 'update' in request.form:
|
||||||
while not s2flask.empty():
|
send_and_wait(c2s, 'update')
|
||||||
input = s2flask.get()
|
|
||||||
c2s.put({'op': 'update'})
|
|
||||||
while s2flask.empty():
|
|
||||||
pass
|
|
||||||
input = s2flask.get()
|
|
||||||
elif 'next_preview' in request.form:
|
elif 'next_preview' in request.form:
|
||||||
while not s2flask.empty():
|
send_and_wait(c2s, 'next_preview')
|
||||||
input = s2flask.get()
|
|
||||||
c2s.put({'op': 'next_preview'})
|
|
||||||
while s2flask.empty():
|
|
||||||
pass
|
|
||||||
input = s2flask.get()
|
|
||||||
elif 'change_history_range' in request.form:
|
elif 'change_history_range' in request.form:
|
||||||
while not s2flask.empty():
|
send_and_wait(c2s, 'change_history_range')
|
||||||
input = s2flask.get()
|
|
||||||
c2s.put({'op': 'change_history_range'})
|
|
||||||
while s2flask.empty():
|
|
||||||
pass
|
|
||||||
input = s2flask.get()
|
|
||||||
# return '', 204
|
# return '', 204
|
||||||
return render_template_string(template)
|
return render_template_string(template)
|
||||||
|
|
||||||
|
@ -430,6 +429,9 @@ def main(args, device_args):
|
||||||
elif show_last_history_iters_count == 100000:
|
elif show_last_history_iters_count == 100000:
|
||||||
show_last_history_iters_count = 0
|
show_last_history_iters_count = 0
|
||||||
update_preview = True
|
update_preview = True
|
||||||
|
elif op == 'close':
|
||||||
|
s2c.put({'op': 'close'})
|
||||||
|
break
|
||||||
|
|
||||||
if update_preview:
|
if update_preview:
|
||||||
update_preview = False
|
update_preview = False
|
||||||
|
@ -456,7 +458,5 @@ def main(args, device_args):
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
s2c.put({'op': 'close'})
|
s2c.put({'op': 'close'})
|
||||||
|
|
||||||
io.destroy_all_windows()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue