Ari1020 commited on
Commit
e31dd93
·
verified ·
1 Parent(s): bb1bb96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -1,18 +1,12 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
-
5
-
6
-
7
-
8
  """
9
  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
10
  """
11
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
12
 
13
 
14
-
15
-
16
  def respond(
17
  message,
18
  history: list[tuple[str, str]],
@@ -25,6 +19,8 @@ def respond(
25
  messages = [{"role": "system", "content": system_message}]
26
 
27
  for val in history:
 
 
28
  if val[1]:
29
  messages.append({"role": "assistant", "content": val[1]})
30
 
@@ -45,7 +41,6 @@ def respond(
45
  yield response
46
 
47
 
48
-
49
  """
50
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
51
  """
@@ -54,16 +49,17 @@ demo = gr.ChatInterface(
54
  additional_inputs=[
55
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
56
 
57
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
58
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
59
  gr.Slider(
60
  minimum=0.1,
 
 
61
  step=0.05,
62
  label="Top-p (nucleus sampling)",
63
  ),
64
 
65
  ],
66
-
67
  )
68
 
69
 
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
 
 
 
 
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(
11
  message,
12
  history: list[tuple[str, str]],
 
19
  messages = [{"role": "system", "content": system_message}]
20
 
21
  for val in history:
22
+ if val[0]:
23
+ messages.append({"role": "user", "content": val[0]})
24
  if val[1]:
25
  messages.append({"role": "assistant", "content": val[1]})
26
 
 
41
  yield response
42
 
43
 
 
44
  """
45
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
46
  """
 
49
  additional_inputs=[
50
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
51
 
52
+ #gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
53
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
54
  gr.Slider(
55
  minimum=0.1,
56
+ maximum=1.0,
57
+ value=0.95,
58
  step=0.05,
59
  label="Top-p (nucleus sampling)",
60
  ),
61
 
62
  ],
 
63
  )
64
 
65