tanyadhast commited on
Commit
f28985c
·
verified ·
1 Parent(s): cf49f6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -6,20 +6,20 @@ from huggingface_hub import InferenceClient
6
  client = InferenceClient('Qwen2.5-7B-Instruct-1M')
7
  def respond(message, history):
8
 
9
- messages = [{role”: system”, content”: You are a friendly chatbot.“}]
10
 
11
  if history:
12
  messages.extend(history)
13
 
14
- messages.append({role”: user”, content”: message})
15
 
16
  response = client.chat_completion(messages, max_tokens = 100)
17
 
18
- return response[choices][0][message][content].strip()
19
  def echo(message, history):
20
  return message
21
  def yes_no(message, history):
22
- responses = [Yes”, No]
23
  return random.choice(responses)
24
  chatbot = gr.ChatInterface(respond, type=“messages”)
25
  chatbot.launch()
 
6
  client = InferenceClient('Qwen2.5-7B-Instruct-1M')
7
  def respond(message, history):
8
 
9
+ messages = [{'role': 'system', 'content': 'You are a friendly chatbot.'}]
10
 
11
  if history:
12
  messages.extend(history)
13
 
14
+ messages.append({"role": "user", "content": message})
15
 
16
  response = client.chat_completion(messages, max_tokens = 100)
17
 
18
+ return response["choices"][0]["message"]["content"].strip()
19
  def echo(message, history):
20
  return message
21
  def yes_no(message, history):
22
+ responses = ["Yes", "No"]
23
  return random.choice(responses)
24
  chatbot = gr.ChatInterface(respond, type=“messages”)
25
  chatbot.launch()