File size: 638 Bytes
267a4f0
 
82e6fd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import streamlit as st

st.title("Groq API Chatbot")
api_key = st.text_input("Enter Groq API Key", type="password")

if "conversation" not in st.session_state:
    st.session_state.conversation = []

user_input = st.text_input("You: ", "")

if st.button("Send"):
    if user_input and api_key:
        st.session_state.conversation.append(f"You: {user_input}")
        
        # Get the response from Groq API
        response = get_groq_response(user_input, api_key)
        st.session_state.conversation.append(f"Bot: {response}")

# Display the conversation history
for message in st.session_state.conversation:
    st.write(message)