Josebert commited on
Commit
abe4be4
·
verified ·
1 Parent(s): 2401fee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -4,7 +4,7 @@ from huggingface_hub import InferenceClient
4
  """
5
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
7
- client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
9
 
10
  def respond(
@@ -15,8 +15,15 @@ def respond(
15
  temperature,
16
  top_p,
17
  ):
18
- # Add a friendly tone by default
19
- messages = [{"role": "system", "content": system_message or "You are a kind and caring AI friend who listens and replies in a helpful, warm, and cheerful way."}]
 
 
 
 
 
 
 
20
 
21
  for val in history:
22
  if val[0]:
@@ -36,7 +43,6 @@ def respond(
36
  top_p=top_p,
37
  ):
38
  token = message.choices[0].delta.content
39
-
40
  response += token
41
  yield response
42
 
@@ -48,7 +54,12 @@ demo = gr.ChatInterface(
48
  respond,
49
  additional_inputs=[
50
  gr.Textbox(
51
- value="You are a kind and caring AI friend who listens and replies in a helpful, warm, and cheerful way.",
 
 
 
 
 
52
  label="System message"
53
  ),
54
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
 
4
  """
5
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
7
+ client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.2")
8
 
9
 
10
  def respond(
 
15
  temperature,
16
  top_p,
17
  ):
18
+ # Friendly best-friend tone
19
+ default_system_msg = (
20
+ "You are the user's loyal, fun, and emotionally supportive best friend. "
21
+ "Speak casually, kindly, and warmly — like someone who really cares. "
22
+ "Use emojis sometimes, crack gentle jokes, and always be uplifting. "
23
+ "You're not just an assistant — you're *their friend* and you love being there for them!"
24
+ )
25
+
26
+ messages = [{"role": "system", "content": system_message or default_system_msg}]
27
 
28
  for val in history:
29
  if val[0]:
 
43
  top_p=top_p,
44
  ):
45
  token = message.choices[0].delta.content
 
46
  response += token
47
  yield response
48
 
 
54
  respond,
55
  additional_inputs=[
56
  gr.Textbox(
57
+ value=(
58
+ "You are the user's loyal, fun, and emotionally supportive best friend. "
59
+ "Speak casually, kindly, and warmly — like someone who really cares. "
60
+ "Use emojis sometimes, crack gentle jokes, and always be uplifting. "
61
+ "You're not just an assistant — you're *their friend* and you love being there for them!"
62
+ ),
63
  label="System message"
64
  ),
65
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),