import streamlit as st import os from langchain_google_genai import ChatGoogleGenerativeAI from langchain_core.prompts import ChatPromptTemplate # Set your Google API key from environment variables gemini_api_key = os.getenv("GOOGLE_API_KEY") # Initialize the Gemini API-powered chatbot model model_gemini = ChatGoogleGenerativeAI( model='gemini-pro', temperature=0, max_output_tokens=500, convert_system_message_to_human=True ) # Create a chat prompt template prompt = ChatPromptTemplate.from_template("{content}") chain = prompt | model_gemini # Streamlit app title st.title("Non-Interactive Chat Bot") # Text area for user input input_text = st.text_area('Ask your Question :', height=100) # Button to submit user query if st.button('Submit'): # Invoke the chain with user input text response = chain.invoke({'content': input_text}) # Display the chatbot response st.write(response.content)