Spaces:
Runtime error
Runtime error
Update app.py
Browse files1 unmodified line23456783 unmodified lines1213141516171819202122231 unmodified line252627281 unmodified lineimport gradio as grimport randomclient = InferenceClient("HuggingFaceH4/zephyr-7b-beta")def respond(message,history):messages = [{"role": "system", "content": "You are a friendly chatbot."}]3 unmodified linesmessages.append({"role": "user", "content": message})response = client.chat_completion(messages,max_tokens=100)return response['choices'][0]['message']['content'].strip()def echo(message, history):choices = ["so true", "shut up", "you need help", "ts pmo sybau"]#use random to select choiceschat_answer = random.choice(choices)return chat_answer1 unmodified linechatbot = gr.ChatInterface(respond, type = "messages")chatbot.launch()1 unmodified line234567893 unmodified lines1314151617181920212223241 unmodified line2627282930311 unmodified lineimport gradio as grimport randomclient = InferenceClient("Qwen/Qwen2.5-72B-Instruct")#this is where you change the LLMdef respond(message,history):messages = [{"role": "system", "content": "You are a friendly chatbot."}]3 unmodified linesmessages.append({"role": "user", "content": message})response = client.chat_completion(messages,max_tokens=100) #changes the length of messagereturn response['choices'][0]['message']['content'].strip()def echo(message, history):choices = ["so true", "shut up", "you need help", "ts pmo sybau"] #change personality#use random to select choiceschat_answer = random.choice(choices)return chat_answer1 unmodified linechatbot = gr.ChatInterface(respond, type = "messages")chatbot.launch()chatbot.launch(debug=True)
app.py+7-4