Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,12 @@ def respond(
|
|
| 11 |
temperature,
|
| 12 |
top_p,
|
| 13 |
):
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
for val in history:
|
| 17 |
if val[0]:
|
|
@@ -38,17 +43,17 @@ def respond(
|
|
| 38 |
demo = gr.ChatInterface(
|
| 39 |
respond,
|
| 40 |
additional_inputs=[
|
| 41 |
-
gr.Textbox(value="Remember to breathe
|
| 42 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 43 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 44 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
| 45 |
],
|
| 46 |
examples=[
|
| 47 |
-
["I
|
| 48 |
-
["Can you
|
| 49 |
-
["I
|
| 50 |
],
|
| 51 |
-
title="Calm Mate"
|
| 52 |
)
|
| 53 |
|
| 54 |
if __name__ == "__main__":
|
|
|
|
| 11 |
temperature,
|
| 12 |
top_p,
|
| 13 |
):
|
| 14 |
+
if system_message is None:
|
| 15 |
+
system_message = "I'm here to help you unwind. Let's take a deep breath together."
|
| 16 |
+
else:
|
| 17 |
+
system_message = "You are a good listener. You advise relaxation exercises, suggest avoiding negative thoughts, and guide through steps to manage stress. Let's discuss what's on your mind, or ask me for a quick relaxation exercise."
|
| 18 |
+
|
| 19 |
+
messages = [{"role": "system", "content": system_message}]
|
| 20 |
|
| 21 |
for val in history:
|
| 22 |
if val[0]:
|
|
|
|
| 43 |
demo = gr.ChatInterface(
|
| 44 |
respond,
|
| 45 |
additional_inputs=[
|
| 46 |
+
gr.Textbox(value="Remember to breathe deeply. Avoid fixating on unhelpful thoughts.", label="System message"),
|
| 47 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 48 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 49 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
| 50 |
],
|
| 51 |
examples=[
|
| 52 |
+
["I feel overwhelmed with work."],
|
| 53 |
+
["Can you guide me through a quick meditation?"],
|
| 54 |
+
["How do I stop worrying about things I can't control?"]
|
| 55 |
],
|
| 56 |
+
title="Calm Mate"
|
| 57 |
)
|
| 58 |
|
| 59 |
if __name__ == "__main__":
|