import streamlit as st from langchain_google_genai import ChatGoogleGenerativeAI st.title("Naman's General Knowledge Q&A Bot") def get_answer(question): prompt = f"Answer the following general knowledge question: {question}" llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"]) response = llm.invoke(prompt) answer = response.content return answer with st.form("question_form"): question = st.text_area("What do you want to ask?") submitted = st.form_submit_button("Get Answer") if submitted and question: answer = get_answer(question) st.info(answer) elif submitted and not question: st.error("Please enter a question to get an answer.")