import streamlit as st
from groq import Groq
# Define the API key here
GROQ_API_KEY = "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"
# Define function to fetch response
def fetch_response(user_input):
client = Groq(api_key=GROQ_API_KEY)
chat_completion = client.chat.completions.create(
messages=[
{"role": "system", "content": "you are a helpful assistant. Take the input from the users and try to provide as detailed response as possible. Provide proper expamples to help the user. Try to mention references or provide citations to make it more detail oriented."},
{"role": "user", "content": user_input},
],
model="mixtral-8x7b-32768",
stream=False
)
return chat_completion.choices[0].message.content
# Set page config
st.set_page_config(
page_title="CyberChat",
page_icon="🤖",
layout="wide",
initial_sidebar_state="expanded"
)
# Cyberpunk style CSS
cyberpunk_style = """
"""
# Streamlit app
st.markdown(cyberpunk_style, unsafe_allow_html=True)
st.title("CyberChat")
st.subheader("Ask a question and get a response.")
# Text input for user's question
user_input = st.text_input("Enter your question here:")
# Button to trigger response
if st.button("Get Response"):
# Fetch and display response
response = fetch_response(user_input)
st.write("Response:", response)
# Footer
st.markdown(
"""
""",
unsafe_allow_html=True
)