Spaces:
Runtime error
Runtime error
Added response function
Browse files40 unmodified lines414243444540 unmodified linesclient = InferenceClient("HuggingFaceH4/zephyr-7b-beta")chatbot.launch()40 unmodified lines4142434445464748495051525354555657585960616263646566676840 unmodified linesclient = InferenceClient("HuggingFaceH4/zephyr-7b-beta")def respond(message, history):info = pull_relevant_info(message)system_message = (f"You are a friendly chatbot. Use the following information to help answer the user's question:\n{info}\n")messages = [{"role": "system", "content": system_message}]if history:messages.extend(history)messages.append({"role": "user", "content": message})response = ""for message_chunk in client.chat_completion(messages,max_tokens=100,stream=True):token = message_chunk['choices'][0]['delta'].get('content', '')respond += tokenyield responsechatbot.launch()
app.py+23