Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,22 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
import random
|
|
|
|
|
|
|
3 |
def respond(message, history):
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|