Spaces:
Runtime error
Runtime error
Update app.py
Browse files1234567891011import gradio as grimport randomdef 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_answerchatbot = gr.ChatInterface(fn=echo, type = "messages", title = "annoying ah chatbot")chatbot.launch()12345678910111213141516171819202122232425262728from huggingface_hub import InferenceClientimport gradio as grimport randomclient = InferenceClient("HuggingFaceH4/zephyr-7b-beta")def respond(message,history):message = [{"role": "system", "content": "You are a friendly chatbot."}]if history:messages.extend(history)messages.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_answerchatbot = gr.ChatInterface(respond, type = "messages")chatbot.launch()
app.py+18-1