lisaude0512 commited on
Commit
87794ef
·
verified ·
1 Parent(s): e699469

adding notes

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -1,15 +1,21 @@
1
  import gradio as gr
2
  import random
3
  from huggingface_hub import InferenceClient
 
4
 
5
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
6
  def respond(message, history):
7
- messages = [{"role": "system", "content": "You are a friendly chatbot."}]
 
8
  if history:
9
  messages.extend(history)
10
  messages.append({"role": "user", "content": message})
11
 
12
- response = client.chat_completion(messages, max_tokens = 100)
 
 
 
 
13
 
14
  print(response["choices"][0]["message"]["content"].strip())
15
  return response["choices"][0]["message"]["content"].strip()
 
1
  import gradio as gr
2
  import random
3
  from huggingface_hub import InferenceClient
4
+ # change the LLM
5
 
6
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
7
  def respond(message, history):
8
+ messages = [{"role": "system", "content": "You are a helpful chatbot."}]
9
+ # change the personality
10
  if history:
11
  messages.extend(history)
12
  messages.append({"role": "user", "content": message})
13
 
14
+ response = client.chat_completion(
15
+ messages,
16
+ max_tokens = 100
17
+ #change the text length
18
+ )
19
 
20
  print(response["choices"][0]["message"]["content"].strip())
21
  return response["choices"][0]["message"]["content"].strip()