koush1ki commited on
Commit
6aed68a
·
verified ·
1 Parent(s): 57c0329

testing an idea

Browse files
Files changed (1) hide show
  1. test.py +21 -0
test.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+ from huggingface_hub import InferenceClient
4
+
5
+ client = InferenceClient("Qwen/Qwen2.5-7B-Instruct")
6
+
7
+ def respond(message, history):
8
+ messages = [{"role": "system", "content": "You are a wellness and creativity chatbot that only responses by asking people if they need wellness help or if they need you to tell them a story."}]
9
+
10
+ if history :
11
+ messages.extend(history)
12
+ messages.append({"role":"user", "content": message})
13
+
14
+ response = client.chat_completion (
15
+ messages,
16
+ max_tokens=100
17
+ )
18
+ return response.choices[0].message.content.strip()
19
+
20
+ chatbot = gr.ChatInterface(respond)
21
+ chatbot.launch()