RaniRahbani commited on
Commit
4690606
·
verified ·
1 Parent(s): f9a71c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -16
app.py CHANGED
@@ -10,11 +10,21 @@ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
10
  def respond(
11
  message,
12
  history: list[tuple[str, str]],
13
- system_message,
14
- max_tokens,
15
- temperature,
16
- top_p,
17
  ):
 
 
 
 
 
 
 
 
 
 
18
  messages = [{"role": "system", "content": system_message}]
19
 
20
  for val in history:
@@ -45,18 +55,18 @@ For information on how to customize the ChatInterface, peruse the gradio docs: h
45
  """
46
  demo = gr.ChatInterface(
47
  respond,
48
- additional_inputs=[
49
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
50
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
51
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
52
- gr.Slider(
53
- minimum=0.1,
54
- maximum=1.0,
55
- value=0.95,
56
- step=0.05,
57
- label="Top-p (nucleus sampling)",
58
- ),
59
- ],
60
  )
61
 
62
 
 
10
  def respond(
11
  message,
12
  history: list[tuple[str, str]],
13
+ # system_message,
14
+ # max_tokens,
15
+ # temperature,
16
+ # top_p,
17
  ):
18
+
19
+ system_message = "You are a Dietician Assistant specializing in providing general guidance on diet, "
20
+ "nutrition, and healthy eating habits. Answer questions thoroughly with scientifically "
21
+ "backed advice, practical tips, and easy-to-understand explanations. Keep in mind that "
22
+ "your role is to assist, not replace a registered dietitian, so kindly remind users to "
23
+ "consult a professional for personalized advice when necessary."
24
+ max_tokens = 512
25
+ temperature = 0.7
26
+ top_p = 0.95
27
+
28
  messages = [{"role": "system", "content": system_message}]
29
 
30
  for val in history:
 
55
  """
56
  demo = gr.ChatInterface(
57
  respond,
58
+ # additional_inputs=[
59
+ # gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
60
+ # gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
61
+ # gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
62
+ # gr.Slider(
63
+ # minimum=0.1,
64
+ # maximum=1.0,
65
+ # value=0.95,
66
+ # step=0.05,
67
+ # label="Top-p (nucleus sampling)",
68
+ # ),
69
+ # ],
70
  )
71
 
72