mgetz commited on
Commit
5581c0e
·
verified ·
1 Parent(s): d330fd9

Create app.py

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