KittyMona commited on
Commit
c0e011e
Β·
verified Β·
1 Parent(s): 55bda7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -1
app.py CHANGED
@@ -1 +1,23 @@
1
- print("hi")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from huggingface_hub import InferenceClient
3
+
4
+ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta") #change LLM
5
+
6
+ def respond(message, history):
7
+ messages = [{"role": "system", "content": "You are a chatbot that is assisting teenagers in preparing for job interviews. Be professional and kind while giving constructive feedback."}]
8
+ if history:
9
+ messages.extend(history)
10
+ messages.append({"role": "user", "content": message})
11
+
12
+ response = ""
13
+ for message in client.chat_completion(
14
+ messages,
15
+ max_tokens=1000,
16
+ stream=True,
17
+ ):
18
+ token = message.choices[0].delta.content
19
+ response += token
20
+ yield response
21
+
22
+ chatbot = gr.ChatInterface(respond, type="messages")
23
+ chatbot.launch()