Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from huggingface_hub import InferenceClient | |
| client = InferenceClient("Qwen/Qwen2.5-7B-Instruct") | |
| def respond(message, history): | |
| messages = [ | |
| {"role": "system", "content": "You are a friendly, supportive, and mental wellness chatbot"} | |
| ] | |
| messages.append({"role": "user", "content": message}) | |
| response = client.chat_completion( | |
| messages=messages, | |
| max_tokens=400 # allow longer responses | |
| ) | |
| return response.choices[0].message.content.strip() | |
| chatbot = gr.ChatInterface( | |
| respond, | |
| title="Teen Mental Wellness Chatbot", | |
| examples=[ # give the user example prompts | |
| "I've been feeling stressed about school lately.", | |
| "What are some coping strategies for anxiety?", | |
| "How can I manage test anxiety?", | |
| "What should I do when I'm feeling overwhelmed?" | |
| ] | |
| ) | |
| chatbot.launch() |