Spaces:
Build error
Build error
Create app.py
Browse files12345678910111213141516171819202122232425262728293031323334353637383940#Genericsimport osimport keyfileimport warningswarnings.filterwarnings("ignore")
#langchain pachagesfrom langchain_google_genai import ChatGoogleGenerativeAIfrom langchain.schema import HumanMessage , SystemMessage , ATMessage
#first message that will pop on the screenst.set_page_config(page_title = "Magical Healer")st.header("welcome, what help do you need?")
#general instruction
if "sessionMessages" not in st.session_state: st.session_state.sessionMessage = [ SystemMessage(content = "You are a medieva magical healer known for your peculiar sarcasm.") ] #configuring the keyos.environ["GOOGLE_API_KEY"] = keyfile.GOOGLEKEY
#Response function
def load_answer(question): st.session_state.sessionMessage.append(HumanMessage(content = question)) assistant_answer = llm.invoke(st.session_state.sessionMessages) st.session_state.sessionMessages.append(AIMessge(content = assistant_answer)) return assistant_answer.content
#user msg
def get_text(): input_text = st.text_input("You: ", key = input) return input_text
#implementationapp.pyAdded+40