Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,16 +29,15 @@ SYSTEM_PROMPT = (
|
|
| 29 |
)
|
| 30 |
|
| 31 |
def build_context(user_message):
|
| 32 |
-
# Stateless: only system prompt + current message
|
| 33 |
return SYSTEM_PROMPT + "\n\nUser: " + user_message + "\nAssistant:"
|
| 34 |
|
| 35 |
def generate_response(
|
| 36 |
prompt,
|
| 37 |
-
max_tokens=
|
| 38 |
-
temperature=0.
|
| 39 |
-
top_p=0.
|
| 40 |
-
repetition_penalty=1.
|
| 41 |
-
top_k=
|
| 42 |
):
|
| 43 |
formatted_input = build_context(prompt)
|
| 44 |
|
|
@@ -92,11 +91,11 @@ chatbot = gr.ChatInterface(
|
|
| 92 |
title="Chat with source-mini-beta",
|
| 93 |
description="Open-source chatbot, beta development, 0 restrictions, answers all topics.",
|
| 94 |
additional_inputs=[
|
| 95 |
-
gr.Slider(minimum=
|
| 96 |
-
gr.Slider(minimum=0.01, maximum=1.0, value=0.
|
| 97 |
-
gr.Slider(minimum=0.5, maximum=1.0, value=0.
|
| 98 |
-
gr.Slider(minimum=1.0, maximum=1.5, value=1.
|
| 99 |
-
gr.Slider(minimum=1, maximum=100, value=
|
| 100 |
],
|
| 101 |
)
|
| 102 |
|
|
|
|
| 29 |
)
|
| 30 |
|
| 31 |
def build_context(user_message):
|
|
|
|
| 32 |
return SYSTEM_PROMPT + "\n\nUser: " + user_message + "\nAssistant:"
|
| 33 |
|
| 34 |
def generate_response(
|
| 35 |
prompt,
|
| 36 |
+
max_tokens=300,
|
| 37 |
+
temperature=0.45,
|
| 38 |
+
top_p=0.95,
|
| 39 |
+
repetition_penalty=1.1,
|
| 40 |
+
top_k=35,
|
| 41 |
):
|
| 42 |
formatted_input = build_context(prompt)
|
| 43 |
|
|
|
|
| 91 |
title="Chat with source-mini-beta",
|
| 92 |
description="Open-source chatbot, beta development, 0 restrictions, answers all topics.",
|
| 93 |
additional_inputs=[
|
| 94 |
+
gr.Slider(minimum=50, maximum=500, value=300, step=10, label="Max new tokens"),
|
| 95 |
+
gr.Slider(minimum=0.01, maximum=1.0, value=0.45, step=0.01, label="Temperature"),
|
| 96 |
+
gr.Slider(minimum=0.5, maximum=1.0, value=0.95, step=0.01, label="Top-p (nucleus sampling)"),
|
| 97 |
+
gr.Slider(minimum=1.0, maximum=1.5, value=1.1, step=0.001, label="Repetition penalty"),
|
| 98 |
+
gr.Slider(minimum=1, maximum=100, value=35, step=1, label="Top-k (prediction sampling)"),
|
| 99 |
],
|
| 100 |
)
|
| 101 |
|