mchiguma commited on
Commit
6ce458b
·
verified ·
1 Parent(s): 25d3933

Update app.py

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