Skip to content

Commit

Permalink
Add no-stream checkbox to the interface
Browse files Browse the repository at this point in the history
  • Loading branch information
oobabooga committed Mar 16, 2023
1 parent 1c37896 commit d54f3f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,9 @@ def create_interface():
shared.gradio['interface'].load(None, None, None, _js=f"() => {{{ui.main_js}}}")

with gr.Tab("Interface mode", elem_id="interface-mode"):
def set_interface_mode(mode, choices):
def set_interface_mode(mode, choices, stream):
shared.args.extensions = choices
shared.args.no_stream = stream
for k in ["notebook", "chat", "cai_chat"]:
exec(f"shared.args.{k} = False")
if mode != "default":
Expand All @@ -402,8 +403,11 @@ def set_interface_mode(mode, choices):
gr.Markdown("*Experimental*")
modes_menu = gr.Dropdown(choices=modes, value=current_mode, label="Mode")
group = gr.CheckboxGroup(choices=extensions, value=shared.args.extensions, label="Available extensions")

with gr.Box():
stream = gr.Checkbox(label='no-stream', value=shared.args.no_stream)
kill = gr.Button("Apply and restart the interface")
kill.click(set_interface_mode, [modes_menu, group], None)
kill.click(set_interface_mode, [modes_menu, group, stream], None)
kill.click(lambda : None, None, None, _js='() => {document.body.innerHTML=\'<h1 style="font-family:monospace;margin-top:20%;color:lightgray;text-align:center;">Reloading...</h1>\'; setTimeout(function(){location.reload()},2500)}')

if shared.args.extensions is not None:
Expand Down

0 comments on commit d54f3f4

Please sign in to comment.