mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-26 01:30:20 +01:00
Use Esc to Stop the generation
This commit is contained in:
parent
3e70bce576
commit
1839dff763
11
css/main.js
11
css/main.js
@ -24,3 +24,14 @@ for(i = 0; i < textareaElements.length; i++) {
|
|||||||
textareaElements[i].classList.add('pretty_scrollbar');
|
textareaElements[i].classList.add('pretty_scrollbar');
|
||||||
textareaElements[i].style.resize = "none";
|
textareaElements[i].style.resize = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stop generation on Esc pressed
|
||||||
|
document.addEventListener("keydown", function(event) {
|
||||||
|
if (event.key === "Escape") {
|
||||||
|
// Find the element with id 'stop' and click it
|
||||||
|
var stopButton = document.getElementById("stop");
|
||||||
|
if (stopButton) {
|
||||||
|
stopButton.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@ -741,7 +741,7 @@ def create_interface():
|
|||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
shared.gradio['Generate'] = gr.Button('Generate', variant='primary', elem_classes="small-button")
|
shared.gradio['Generate'] = gr.Button('Generate', variant='primary', elem_classes="small-button")
|
||||||
shared.gradio['Stop'] = gr.Button('Stop', elem_classes="small-button")
|
shared.gradio['Stop'] = gr.Button('Stop', elem_classes="small-button", elem_id='stop')
|
||||||
shared.gradio['Undo'] = gr.Button('Undo', elem_classes="small-button")
|
shared.gradio['Undo'] = gr.Button('Undo', elem_classes="small-button")
|
||||||
shared.gradio['Regenerate'] = gr.Button('Regenerate', elem_classes="small-button")
|
shared.gradio['Regenerate'] = gr.Button('Regenerate', elem_classes="small-button")
|
||||||
|
|
||||||
@ -772,7 +772,7 @@ def create_interface():
|
|||||||
shared.gradio['max_new_tokens'] = gr.Slider(minimum=shared.settings['max_new_tokens_min'], maximum=shared.settings['max_new_tokens_max'], step=1, label='max_new_tokens', value=shared.settings['max_new_tokens'])
|
shared.gradio['max_new_tokens'] = gr.Slider(minimum=shared.settings['max_new_tokens_min'], maximum=shared.settings['max_new_tokens_max'], step=1, label='max_new_tokens', value=shared.settings['max_new_tokens'])
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
shared.gradio['Generate'] = gr.Button('Generate', variant='primary')
|
shared.gradio['Generate'] = gr.Button('Generate', variant='primary')
|
||||||
shared.gradio['Stop'] = gr.Button('Stop')
|
shared.gradio['Stop'] = gr.Button('Stop', elem_id='stop')
|
||||||
shared.gradio['Continue'] = gr.Button('Continue')
|
shared.gradio['Continue'] = gr.Button('Continue')
|
||||||
shared.gradio['count_tokens'] = gr.Button('Count tokens')
|
shared.gradio['count_tokens'] = gr.Button('Count tokens')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user