Spaces:
Sleeping
Sleeping
Update app.py
Browse files123456789101112import gradio as grimport randomdef echo(message, history):choices = ["yes", "no","No, you're not eating", "Yes, ate down diva", "No, you're not slick","Not today hunny", "Yes, level 100 gyatt","Naur, Bad girl", "Naur, Bad boy","Oui,good girl","Oui, good boy"]#use random to select one of those messagesrandom_word = random.choice(choices)return random_wordchatbot = gr.ChatInterface(echo, type = "messages")chatbot.launch()12345678910111213141516171819202122232425262728293031import gradio as grimport randomfrom huggingface_hub import InferenceClientclient = InferenceClient("HuggingFaceH4/zephyr-7b-beta")def respond(message, history):messages = [{"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_toxens = 100)print(response['choices'][0]['message']['content'].strip())return response['choices'][0]['message']['content'].strip()def echo(message, history):choices = ["yes", "no","No, you're not eating", "Yes, ate down diva", "No, you're not slick","Not today hunny", "Yes, level 100 gyatt","Naur, Bad girl", "Naur, Bad boy","Oui,good girl","Oui, good boy"]#use random to select one of those messagesrandom_word = random.choice(choices)return random_wordchatbot = gr.ChatInterface(respond, type = "messages")chatbot.launch()
app.py+21-2