NinjaTribe commited on
Commit
8ec9d67
·
verified ·
1 Parent(s): e3caa19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -34
app.py CHANGED
@@ -7,26 +7,6 @@ For more information on `huggingface_hub` Inference API support, please check th
7
  """
8
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
9
 
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:
21
- if val[0]:
22
- messages.append({"role": "user", "content": val[0]})
23
- if val[1]:
24
- messages.append({"role": "assistant", "content": val[1]})
25
-
26
- messages.append({"role": "user", "content": message})
27
-
28
- response = ""
29
-
30
  PERSONALITY = os.environ.get("CHATBOT_PERSONALITY")
31
 
32
  def chatbot(message, history):
@@ -38,20 +18,10 @@ def chatbot(message, history):
38
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
39
  """
40
  demo = gr.ChatInterface(
41
- respond,
42
- additional_inputs=[
43
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
44
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
45
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
46
- gr.Slider(
47
- minimum=0.1,
48
- maximum=1.0,
49
- value=0.95,
50
- step=0.05,
51
- label="Top-p (nucleus sampling)",
52
- ),
53
- ],
54
- )
55
 
56
 
57
  if __name__ == "__main__":
 
7
  """
8
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  PERSONALITY = os.environ.get("CHATBOT_PERSONALITY")
11
 
12
  def chatbot(message, history):
 
18
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
19
  """
20
  demo = gr.ChatInterface(
21
+ chatbot,
22
+ title="Shinobi - Japanese Culture Specialist",
23
+ description="A chatbot specializing in Japanese culture.",
24
+ type="messages"
 
 
 
 
 
 
 
 
 
 
25
 
26
 
27
  if __name__ == "__main__":