Spaces:
Sleeping
Sleeping
File size: 1,119 Bytes
ac586a1 918d797 e699469 87794ef ac586a1 f260928 e699469 875c036 87794ef e699469 e63c0d1 87794ef db21f38 e63c0d1 94f7bca 00002ef c0396f8 00002ef c0396f8 00002ef ac586a1 e699469 f260928 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import gradio as gr
import random
from huggingface_hub import InferenceClient
# change the LLM
client = InferenceClient("Qwen/Qwen2.5-72B-Instruct")
def respond(message, history):
messages = [{"role": "system", "content": "You are a big sister chatbot named, Nessie. You help people feel better about their bodies and self-image."}]
# change the personality
if history:
messages.extend(history)
messages.append({"role": "user", "content": message})
response = ""
for messages in client.chat_completion(
messages,
max_tokens = 500,
stream = True,
):
token = messages.choices[0].delta.content
response+= token
yield response
theme = gr.themes.Soft(
primary_hue="rose",
secondary_hue="zinc",
neutral_hue="pink",
)
with gr.Blocks(theme=theme) as demo:
chatbot = gr.ChatInterface(
fn=respond,
type='messages',
title="Hi! I'm Nessie, your personal wellness assistant. What can I assist you with today?"
)
chatbot = gr.ChatInterface(respond, type = "messages")
chatbot.launch(debug=True) |