Update app.py
Browse files
app.py
CHANGED
|
@@ -78,37 +78,37 @@ with gr.Blocks(css=CSS) as demo:
|
|
| 78 |
gr.Markdown("# π OpenOrca x OpenChat - Preview2 - 13B Playground Space! π")
|
| 79 |
#chatbot = gr.Chatbot().style(height=500)
|
| 80 |
chatbot = gr.Chatbot(elem_id="chatbot")
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
)
|
| 87 |
-
with gr.Row():
|
| 88 |
-
submit = gr.Button(value="Send message", variant="secondary").style(full_width=True)
|
| 89 |
-
clear = gr.Button(value="New topic", variant="secondary").style(full_width=False)
|
| 90 |
-
stop = gr.Button(value="Stop", variant="secondary").style(full_width=False)
|
| 91 |
-
with gr.Accordion("Show Model Parameters", open=False):
|
| 92 |
-
with gr.Row():
|
| 93 |
-
with gr.Column():
|
| 94 |
-
max_tokens = gr.Slider(20, 1000, label="Max Tokens", step=20, value=500)
|
| 95 |
-
temperature = gr.Slider(0.2, 2.0, label="Temperature", step=0.1, value=0.8)
|
| 96 |
-
top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.95)
|
| 97 |
-
top_k = gr.Slider(0, 100, label="Top K", step=1, value=40)
|
| 98 |
-
repetition_penalty = gr.Slider(0.0, 2.0, label="Repetition Penalty", step=0.1, value=1.1)
|
| 99 |
-
|
| 100 |
-
system_msg = gr.Textbox(
|
| 101 |
-
start_message, label="System Message", interactive=True, visible=True, placeholder="System prompt. Provide instructions which you want the model to remember.", lines=5)
|
| 102 |
-
|
| 103 |
-
chat_history_state = gr.State()
|
| 104 |
-
clear.click(clear_chat, inputs=[chat_history_state, message], outputs=[chat_history_state, message], queue=False)
|
| 105 |
-
clear.click(lambda: None, None, chatbot, queue=False)
|
| 106 |
-
|
| 107 |
-
submit_click_event = submit.click(
|
| 108 |
-
fn=user, inputs=[message, chat_history_state], outputs=[message, chat_history_state], queue=True
|
| 109 |
-
).then(
|
| 110 |
-
fn=chat, inputs=[chat_history_state, system_msg, max_tokens, temperature, top_p, top_k, repetition_penalty], outputs=[chatbot, chat_history_state, message], queue=True
|
| 111 |
)
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
demo.queue(max_size=128, concurrency_count=48).launch(debug=True, server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 78 |
gr.Markdown("# π OpenOrca x OpenChat - Preview2 - 13B Playground Space! π")
|
| 79 |
#chatbot = gr.Chatbot().style(height=500)
|
| 80 |
chatbot = gr.Chatbot(elem_id="chatbot")
|
| 81 |
+
with gr.Row():
|
| 82 |
+
message = gr.Textbox(
|
| 83 |
+
label="What do you want to chat about?",
|
| 84 |
+
placeholder="Ask me anything.",
|
| 85 |
+
lines=3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
)
|
| 87 |
+
with gr.Row():
|
| 88 |
+
submit = gr.Button(value="Send message", variant="secondary").style(full_width=True)
|
| 89 |
+
clear = gr.Button(value="New topic", variant="secondary").style(full_width=False)
|
| 90 |
+
stop = gr.Button(value="Stop", variant="secondary").style(full_width=False)
|
| 91 |
+
with gr.Accordion("Show Model Parameters", open=False):
|
| 92 |
+
with gr.Row():
|
| 93 |
+
with gr.Column():
|
| 94 |
+
max_tokens = gr.Slider(20, 1000, label="Max Tokens", step=20, value=500)
|
| 95 |
+
temperature = gr.Slider(0.2, 2.0, label="Temperature", step=0.1, value=0.8)
|
| 96 |
+
top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.95)
|
| 97 |
+
top_k = gr.Slider(0, 100, label="Top K", step=1, value=40)
|
| 98 |
+
repetition_penalty = gr.Slider(0.0, 2.0, label="Repetition Penalty", step=0.1, value=1.1)
|
| 99 |
+
|
| 100 |
+
system_msg = gr.Textbox(
|
| 101 |
+
start_message, label="System Message", interactive=True, visible=True, placeholder="System prompt. Provide instructions which you want the model to remember.", lines=5)
|
| 102 |
+
|
| 103 |
+
chat_history_state = gr.State()
|
| 104 |
+
clear.click(clear_chat, inputs=[chat_history_state, message], outputs=[chat_history_state, message], queue=False)
|
| 105 |
+
clear.click(lambda: None, None, chatbot, queue=False)
|
| 106 |
+
|
| 107 |
+
submit_click_event = submit.click(
|
| 108 |
+
fn=user, inputs=[message, chat_history_state], outputs=[message, chat_history_state], queue=True
|
| 109 |
+
).then(
|
| 110 |
+
fn=chat, inputs=[chat_history_state, system_msg, max_tokens, temperature, top_p, top_k, repetition_penalty], outputs=[chatbot, chat_history_state, message], queue=True
|
| 111 |
+
)
|
| 112 |
+
stop.click(fn=None, inputs=None, outputs=None, cancels=[submit_click_event], queue=False)
|
| 113 |
|
| 114 |
demo.queue(max_size=128, concurrency_count=48).launch(debug=True, server_name="0.0.0.0", server_port=7860)
|