Spaces:
Sleeping
Sleeping
Update app.py
Browse files1234567891011import gradio as grimport randomdef random_message(message, history):choices = ["it is likely", "absolutely not", "try again", "without a doubt", "outlook good", "signs point to it", "very unlikely", "quite doubtful"]chat_answer = random.choice(choices)return chat_answerchatbot = gr.ChatInterface(random_message, type = "messages", title = "Random Response Chatbot", description = "<center> ask me a question, i'll give you the answer")chatbot.launch()12345678910111213141516171819202122232425262728import 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_tokens = 100)print(response["choices"][0]["message"]["content"].strip())return response["choices"][0]["message"]["content"].strip()def random_message(message, history):choices = ["it is likely", "absolutely not", "try again", "without a doubt", "outlook good", "signs point to it", "very unlikely", "quite doubtful"]chat_answer = random.choice(choices)return chat_answerchatbot = gr.ChatInterface(respond, type = "messages")chatbot.launch()
app.py+18-1