Spaces:
Sleeping
Sleeping
import streamlit as st | |
from huggingface_hub import InferenceClient | |
# | |
st.title("Chatbot App") | |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1") | |
def get_chat_response(message): | |
chat_completion = client.chat_completion( | |
messages=[ | |
{ | |
"role": "user", | |
"content": message, | |
} | |
], max_tokens=100 | |
) | |
return chat_completion.choices[0].message.content | |
user_input = st.text_input("Enter your message:") | |
if st.button("Send"): | |
if user_input: | |
response = get_chat_response(user_input) | |
st.text("Bot's Response:") | |
st.write(response) | |
else: | |
st.warning("Please enter a message.") |