Make chat mode more like cai
This commit is contained in:
parent
9f1b6e0398
commit
e6691bd920
3 changed files with 27 additions and 29 deletions
|
@ -4,7 +4,7 @@ A gradio webui for running large language models like gpt-j-6B, gpt-neo, opt, ga
|
||||||
|
|
||||||
Its goal is to become the [AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) of text generation.
|
Its goal is to become the [AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) of text generation.
|
||||||
|
|
||||||
| |  |
|
| |  |
|
||||||
|:---:|:---:|
|
|:---:|:---:|
|
||||||
| |  |
|
| |  |
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ def generate_chat_html(history, name1, name2):
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
height: 50vh;
|
height: 66.67vh;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
26
server.py
26
server.py
|
@ -268,10 +268,19 @@ elif args.chat or args.cai_chat:
|
||||||
name1_str = settings['name1']
|
name1_str = settings['name1']
|
||||||
name2_str = settings['name2']
|
name2_str = settings['name2']
|
||||||
|
|
||||||
with gr.Blocks(css=css+".h-\[40vh\] {height: 50vh}", analytics_enabled=False) as interface:
|
with gr.Blocks(css=css+".h-\[40vh\] {height: 66.67vh} .gradio-container {max-width: 800px; margin-left: auto; margin-right: auto}", analytics_enabled=False) as interface:
|
||||||
gr.Markdown(description)
|
if args.cai_chat:
|
||||||
|
display1 = gr.HTML(value=generate_chat_html([], "", ""))
|
||||||
|
else:
|
||||||
|
display1 = gr.Chatbot()
|
||||||
|
textbox = gr.Textbox(lines=2, label='Input')
|
||||||
|
btn = gr.Button("Generate")
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
with gr.Column():
|
with gr.Column():
|
||||||
|
btn3 = gr.Button("Remove last message")
|
||||||
|
with gr.Column():
|
||||||
|
btn2 = gr.Button("Clear history")
|
||||||
|
|
||||||
length_slider = gr.Slider(minimum=settings['max_new_tokens_min'], maximum=settings['max_new_tokens_max'], step=1, label='max_new_tokens', value=settings['max_new_tokens'])
|
length_slider = gr.Slider(minimum=settings['max_new_tokens_min'], maximum=settings['max_new_tokens_max'], step=1, label='max_new_tokens', value=settings['max_new_tokens'])
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
with gr.Column():
|
with gr.Column():
|
||||||
|
@ -285,18 +294,7 @@ elif args.chat or args.cai_chat:
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
check = gr.Checkbox(value=settings['stop_at_newline'], label='Stop generating at new line character?')
|
check = gr.Checkbox(value=settings['stop_at_newline'], label='Stop generating at new line character?')
|
||||||
|
|
||||||
with gr.Column():
|
|
||||||
if args.cai_chat:
|
|
||||||
display1 = gr.HTML(value=generate_chat_html([], "", ""))
|
|
||||||
else:
|
|
||||||
display1 = gr.Chatbot()
|
|
||||||
textbox = gr.Textbox(lines=2, label='Input')
|
|
||||||
btn = gr.Button("Generate")
|
|
||||||
with gr.Row():
|
|
||||||
with gr.Column():
|
|
||||||
btn3 = gr.Button("Remove last message")
|
|
||||||
with gr.Column():
|
|
||||||
btn2 = gr.Button("Clear history")
|
|
||||||
|
|
||||||
if args.cai_chat:
|
if args.cai_chat:
|
||||||
btn.click(cai_chatbot_wrapper, [textbox, length_slider, preset_menu, model_menu, name1, name2, context, check], display1, show_progress=True, api_name="textgen")
|
btn.click(cai_chatbot_wrapper, [textbox, length_slider, preset_menu, model_menu, name1, name2, context, check], display1, show_progress=True, api_name="textgen")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue