Sadmo commited on
Commit
29b6d52
·
verified ·
1 Parent(s): b692751

Updated app.py to basic skeleton

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py CHANGED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+ from huggingface_hub import InferenceClient
4
+
5
+ client = InferenceClient("ResembleAI/chatterbox")
6
+
7
+
8
+
9
+ def respond(message, history):
10
+ messages = [{"role": "system", "content":"You are a friendly chatbot."}]
11
+ if history:
12
+ messages.extend(history)
13
+ messages.append({"role": "user", "content": message})
14
+
15
+ response = client.chat_completion(
16
+ messages,
17
+ max_tokens=100
18
+ )
19
+
20
+ return response['choices'][0]['message']['content'].strip()
21
+
22
+ chatbot = gr.ChatInterface(respond, type = "messages", title = "SadhanaGPT for KWK", theme = gr.themes.Glass(), examples = ["How's the weather today?", "Who won the match?", "Is the sky green?"])
23
+
24
+ chatbot.launch()