import os import streamlit as st from groq import Groq st.set_page_config(page_title="Sample Chatbot", page_icon="🤖") st.title("🤖 Jehan Zada Chatboot") # Read API key api_key = os.getenv("Samplechatboot") if not api_key: st.error("API key not found. Please add Samplechatboot in Space secrets.") st.stop() client = Groq(api_key=api_key) user_input = st.text_input("Ask your question:") if st.button("Send"): if user_input.strip(): with st.spinner("Thinking..."): response = client.chat.completions.create( model="llama-3.3-70b-versatile", messages=[{"role": "user", "content": user_input}], ) st.success("Response:") st.write(response.choices[0].message.content) else: st.warning("Please enter a message.")