Spaces:
Sleeping
Sleeping
Connecting to zephyr LLM
Browse files1234567891011121314import gradio as grimport randomdef echo(message, history):choices = ["Ask me later", "Not today, sweetie", "One day we'll know", "Indeed!", "Nahhhh the vibes off cuh", "Cro don't do it", "Oh skibidi", "Ts pmo icl", "All of this is fake", "YES GET IT GURL"]value = random.choice(choices)return valuechatbot = gr.ChatInterface(echo, type = "messages")chatbot.launch()1234567891011121314151617181920212223242526import gradio as grfrom huggingface_hub import InferenceClientimport randomclient = InferenceClient("HuggingFaceH4/zephyr-7b-beta")#def echo(message, history):#choices = ["Ask me later", "Not today, sweetie", "One day we'll know", "Indeed!", "Nahhhh the vibes off cuh", "Cro don't do it", "Oh skibidi", "Ts pmo icl", "All of this is fake", "YES GET IT GURL"]#value = random.choice(choices)#return valuedef respond(message, history):messages [{"role": "system", "content": "You are a friendly chatbot."}]if history:messages.extend(history)#adds multiple value + types rather than just onemessages.append("{"role": "user", "content": message})response = client.chat_completion(messages, max_tokens=0)print(response)return response['choices'][0]['message']['content'].strip()chatbot = gr.ChatInterface(respond, type = "messages")chatbot.launch()
app.py+18-6