mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2026-04-05 06:35:15 +00:00
Fix the UI failing to launch if the Notebook prompt is too long
This commit is contained in:
parent
08f90f4b64
commit
a3eb67e466
4 changed files with 11 additions and 6 deletions
|
|
@ -22,8 +22,7 @@ def load_prompt(fname):
|
|||
if file_path.exists():
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
text = f.read()
|
||||
if len(text) > 0 and text[-1] == '\n':
|
||||
text = text[:-1]
|
||||
text = text.rstrip()
|
||||
|
||||
return text
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ def create_ui():
|
|||
with gr.Row():
|
||||
with gr.Column():
|
||||
with gr.Row():
|
||||
initial_text = load_prompt(shared.settings['prompt-notebook'])
|
||||
shared.gradio['textbox-default'] = gr.Textbox(value=initial_text, lines=27, label='Input', elem_classes=['textbox_default', 'add_scrollbar'])
|
||||
shared.gradio['textbox-default'] = gr.Textbox(value="", lines=27, label='Input', elem_classes=['textbox_default', 'add_scrollbar'])
|
||||
shared.gradio['token-counter-default'] = gr.HTML(value="<span>0</span>", elem_id="default-token-counter")
|
||||
|
||||
with gr.Row():
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ def create_ui():
|
|||
with gr.Column(scale=4):
|
||||
with gr.Tab('Raw'):
|
||||
with gr.Row():
|
||||
initial_text = load_prompt(shared.settings['prompt-notebook'])
|
||||
shared.gradio['textbox-notebook'] = gr.Textbox(label="", value=initial_text, lines=27, elem_id='textbox-notebook', elem_classes=['textbox', 'add_scrollbar'])
|
||||
shared.gradio['textbox-notebook'] = gr.Textbox(label="", value="", lines=27, elem_id='textbox-notebook', elem_classes=['textbox', 'add_scrollbar'])
|
||||
shared.gradio['token-counter-notebook'] = gr.HTML(value="<span>0</span>", elem_id="notebook-token-counter")
|
||||
|
||||
with gr.Tab('Markdown'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue