TeahReichenbaum commited on
Commit
e2af0c1
·
verified ·
1 Parent(s): c2d6864

attempt to fix error

Browse files
Files changed (1) hide show
  1. app.py +13 -21
app.py CHANGED
@@ -1,32 +1,24 @@
1
  import gradio as gr
2
- import random
3
- import os
4
-
5
  from huggingface_hub import InferenceClient
6
 
7
-
8
-
9
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
10
 
11
-
12
- def respond(message,history):
13
  messages = [{"role": "system", "content": "You are a friendly chatbot."}]
14
-
15
  if history:
16
  messages.extend(history)
17
- messages.append({"role":"user","content":messages})
18
-
 
19
  response = client.chat_completion(
20
- mesages,
21
- max_token=100)
22
- return response ['choices'][0]['message']['content'].strip()
23
-
24
-
25
-
26
-
27
- chatbot = gr.ChatInterface(respond, type = "messages")
28
-
29
- chatbot.launch()
30
-
31
 
 
32
 
 
 
1
  import gradio as gr
 
 
 
2
  from huggingface_hub import InferenceClient
3
 
 
 
4
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
5
 
6
+ def respond(message, history):
7
+
8
  messages = [{"role": "system", "content": "You are a friendly chatbot."}]
9
+
10
  if history:
11
  messages.extend(history)
12
+
13
+ messages.append({"role": "user", "content": message})
14
+
15
  response = client.chat_completion(
16
+ messages,
17
+ max_tokens=100
18
+ )
19
+
20
+ return response['choices'][0]['message']['content'].strip()
 
 
 
 
 
 
21
 
22
+ chatbot = gr.ChatInterface(respond, type="messages")
23
 
24
+ chatbot.launch()