smriti-m commited on
Commit
57bc067
·
verified ·
1 Parent(s): 1dc3d06

Update app.py

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