Update app.py
Browse files
app.py
CHANGED
@@ -39,24 +39,23 @@ with gr.Blocks(css=".gr-box { border-radius: 12px; padding: 16px; }") as demo:
|
|
39 |
elem_classes=["gr-box"]
|
40 |
)
|
41 |
|
42 |
-
|
43 |
-
chatbot = gr.Chatbot(label="Chat", show_copy_button=True, type="messages").style(height=400)
|
44 |
|
45 |
-
with gr.Row(
|
46 |
system_msg = gr.Textbox(
|
47 |
label="🧠 System Prompt",
|
48 |
value="You are a friendly assistant.",
|
49 |
lines=2,
|
50 |
-
interactive=True
|
|
|
51 |
)
|
52 |
with gr.Row():
|
53 |
max_tokens = gr.Slider(1, 2048, value=512, step=1, label="Max Tokens")
|
54 |
temperature = gr.Slider(0.1, 4.0, value=0.7, step=0.1, label="Temperature")
|
55 |
top_p = gr.Slider(0.1, 1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
# Bind function to chat
|
61 |
def user_submit(user_message, history, system_message, max_tokens, temperature, top_p):
|
62 |
return respond(user_message, history, system_message, max_tokens, temperature, top_p)
|
@@ -70,4 +69,3 @@ with gr.Blocks(css=".gr-box { border-radius: 12px; padding: 16px; }") as demo:
|
|
70 |
# Launch
|
71 |
if __name__ == "__main__":
|
72 |
demo.launch()
|
73 |
-
|
|
|
39 |
elem_classes=["gr-box"]
|
40 |
)
|
41 |
|
42 |
+
chatbot = gr.Chatbot(label="Chat", show_copy_button=True, type="messages")
|
|
|
43 |
|
44 |
+
with gr.Row():
|
45 |
system_msg = gr.Textbox(
|
46 |
label="🧠 System Prompt",
|
47 |
value="You are a friendly assistant.",
|
48 |
lines=2,
|
49 |
+
interactive=True,
|
50 |
+
scale=2
|
51 |
)
|
52 |
with gr.Row():
|
53 |
max_tokens = gr.Slider(1, 2048, value=512, step=1, label="Max Tokens")
|
54 |
temperature = gr.Slider(0.1, 4.0, value=0.7, step=0.1, label="Temperature")
|
55 |
top_p = gr.Slider(0.1, 1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
|
56 |
|
57 |
+
msg_input = gr.Textbox(label="💬 Your message", placeholder="Type a message and press Enter...")
|
58 |
+
|
|
|
59 |
# Bind function to chat
|
60 |
def user_submit(user_message, history, system_message, max_tokens, temperature, top_p):
|
61 |
return respond(user_message, history, system_message, max_tokens, temperature, top_p)
|
|
|
69 |
# Launch
|
70 |
if __name__ == "__main__":
|
71 |
demo.launch()
|
|