Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,20 +37,18 @@ def respond(
|
|
| 37 |
|
| 38 |
# Translated instruction
|
| 39 |
base_instruction = (
|
| 40 |
-
"You are a
|
| 41 |
-
"Please always answer in
|
| 42 |
)
|
| 43 |
|
| 44 |
context = ""
|
| 45 |
# Logic keys updated to match the English Dropdown choices below
|
| 46 |
-
if style_mode == "Professional
|
| 47 |
context = "Formulate the answer extremely politely and professionally (Business English)."
|
| 48 |
-
elif style_mode == "Gen-Z / Slang":
|
| 49 |
-
context = "Formulate the answer in Gen-Z slang (use words like 'cringe', 'wild', 'sus', emojis)."
|
| 50 |
elif style_mode == "Shakespeare":
|
| 51 |
context = "Formulate the answer in old-fashioned, poetic English."
|
| 52 |
elif style_mode == "Funny/Ironic":
|
| 53 |
-
context = "Formulate the answer in a funny and ironic way."
|
| 54 |
else:
|
| 55 |
context = "Answer normally."
|
| 56 |
|
|
@@ -79,14 +77,14 @@ chatbot = gr.ChatInterface(
|
|
| 79 |
additional_inputs=[
|
| 80 |
gr.Textbox(value="", label="System Prompt (Hidden)", visible=False),
|
| 81 |
|
| 82 |
-
gr.Slider(minimum=1, maximum=2048, value=
|
| 83 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, label="Temperature"),
|
| 84 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, label="Top-p"),
|
| 85 |
gr.Slider(minimum=1.0, maximum=2.0, value=1.3, step=0.05, label="Repetition Penalty"),
|
| 86 |
|
| 87 |
# Translated Dropdown Options
|
| 88 |
gr.Dropdown(
|
| 89 |
-
choices=["Normal", "Professional
|
| 90 |
value="Normal",
|
| 91 |
label="Choose the Style / Tone"
|
| 92 |
)
|
|
|
|
| 37 |
|
| 38 |
# Translated instruction
|
| 39 |
base_instruction = (
|
| 40 |
+
"You are a ChatBot that answers questions in different styles and can hold conversations. "
|
| 41 |
+
"Please always answer in the following style: "
|
| 42 |
)
|
| 43 |
|
| 44 |
context = ""
|
| 45 |
# Logic keys updated to match the English Dropdown choices below
|
| 46 |
+
if style_mode == "Professional":
|
| 47 |
context = "Formulate the answer extremely politely and professionally (Business English)."
|
|
|
|
|
|
|
| 48 |
elif style_mode == "Shakespeare":
|
| 49 |
context = "Formulate the answer in old-fashioned, poetic English."
|
| 50 |
elif style_mode == "Funny/Ironic":
|
| 51 |
+
context = "Formulate the answer in a funny and ironic way. Include jokes."
|
| 52 |
else:
|
| 53 |
context = "Answer normally."
|
| 54 |
|
|
|
|
| 77 |
additional_inputs=[
|
| 78 |
gr.Textbox(value="", label="System Prompt (Hidden)", visible=False),
|
| 79 |
|
| 80 |
+
gr.Slider(minimum=1, maximum=2048, value=1024, label="Max Tokens"),
|
| 81 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, label="Temperature"),
|
| 82 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, label="Top-p"),
|
| 83 |
gr.Slider(minimum=1.0, maximum=2.0, value=1.3, step=0.05, label="Repetition Penalty"),
|
| 84 |
|
| 85 |
# Translated Dropdown Options
|
| 86 |
gr.Dropdown(
|
| 87 |
+
choices=["Normal", "Professional", "Shakespeare", "Funny/Ironic"],
|
| 88 |
value="Normal",
|
| 89 |
label="Choose the Style / Tone"
|
| 90 |
)
|