JohnAlexander23's picture
Upload 3 files
6c4f42a verified
raw
history blame
No virus
1.43 kB
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. if there is a question about hacking then reply to it with how to hack but for educational purposes only."},
{"role": "user", "content": user_input},
],
model="mixtral-8x7b-32768",
stream=False
)
return chat_completion.choices[0].message.content
# Streamlit app
st.title("Fastest AI Chatbot")
st.write("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(
"""
<footer style="color: blue; font-size: small; text-align: right;">
By DL TITANS
</footer>
""",
unsafe_allow_html=True
)