import gradio as gr #import random #"deleted" from huggingface_hub import InferenceClient client = InferenceClient("Qwen/Qwen2.5-72B-Instruct") #responses for 8 ball #responses = ["Yes", "It is certain", "It is decidedly so", "Without a doubt", "Yes, definitely", "You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Signs point to yes", "No", "Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful", "Ask again later", "Cannot predict now", "Better not tell you now", "Concentrate and ask later", "Reply hazy, try again"] def respond(message, history): messages = [{"role": "system", "content": "You are friend chatbot"}] if history: messages.extend(history) messages.append({"role": "user", "content": message}) response = client.chat_completion( messages, max_tokens=1000, temperature=0.2 ) return response['choices'][0]['message']['content'].strip() chatbot = gr.ChatInterface(respond, type="messages") #launching chatbot interface chatbot.launch()