KittyMona commited on
Commit
9120c16
·
verified ·
1 Parent(s): 6fdf1ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -1,14 +1,21 @@
 
1
  import gradio as gr
2
- import random
3
 
4
- response_list = ["This why Marcus thinks you're annoying", "meow", "I see", "Bruh", "This is bummy"]
5
 
6
- def echo(message, history):
7
- random_element = random.choice(response_list)
8
- return random_element
9
 
10
- print("Hello, world!")
 
 
 
 
 
 
 
 
 
11
 
12
- chatbot = gr.ChatInterface(echo, type="messages", title="Lauren as a Robot")
13
 
14
  chatbot.launch()
 
1
+ from huggingface_hub import InferenceClient
2
  import gradio as gr
 
3
 
4
+ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
5
 
6
+ response_list = ["This why Marcus thinks you're annoying", "meow", "I see", "Bruh", "This is bummy"]
 
 
7
 
8
+ def respond()
9
+ messages = [{"role": "system", "content":, "You are a friendly chatbot."}]
10
+ if history:
11
+ messages.extend(history)
12
+ messages.append({"role": "user", "content": "message"})
13
+ response = client.chat_completion(
14
+ messages,
15
+ max_tokens=100
16
+ )
17
+ return response['choices'][0]['message']['content'].strip()
18
 
19
+ chatbot = gr.ChatInterface(respond, type="messages", title="Lauren as a Robot")
20
 
21
  chatbot.launch()