Spaces:
Sleeping
Sleeping
Beta-version 2
Browse files
app.py
CHANGED
|
@@ -13,22 +13,29 @@ from langchain.schema import HumanMessage, SystemMessage, AIMessage
|
|
| 13 |
st.set_page_config(page title = "Magical Healer")
|
| 14 |
st.header("Welcome, How can I help you?")
|
| 15 |
|
| 16 |
-
#Configure the key
|
| 17 |
-
os.environ["GOOGLE_API_KEY"] = keyfile.GOOGLEKEY
|
| 18 |
-
|
| 19 |
#General Instruction
|
| 20 |
if "sessionMessages" not in st.session_state:
|
| 21 |
st.session_state.sessionMessage=[
|
| 22 |
SystemMessage(content="You are a medievel magical healer known for your peculiar sarcasm")
|
| 23 |
]
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
#User message
|
| 26 |
def get_text():
|
| 27 |
input_text=st.text_input("You: ", key=input)
|
| 28 |
return input_text
|
| 29 |
|
| 30 |
#Working with Responses
|
| 31 |
-
|
| 32 |
def load_answer(question):
|
| 33 |
#This is code, where we are adding new message to the model
|
| 34 |
st.session_state.sessionMessages.append(HumanMessage(content=question))
|
|
|
|
| 13 |
st.set_page_config(page title = "Magical Healer")
|
| 14 |
st.header("Welcome, How can I help you?")
|
| 15 |
|
|
|
|
|
|
|
|
|
|
| 16 |
#General Instruction
|
| 17 |
if "sessionMessages" not in st.session_state:
|
| 18 |
st.session_state.sessionMessage=[
|
| 19 |
SystemMessage(content="You are a medievel magical healer known for your peculiar sarcasm")
|
| 20 |
]
|
| 21 |
|
| 22 |
+
#Configure the key
|
| 23 |
+
os.environ["GOOGLE_API_KEY"] = keyfile.GOOGLEKEY
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# Create the model
|
| 27 |
+
llm = ChatGoogleGenerativeAI(
|
| 28 |
+
model="gemini-1.5-pro",
|
| 29 |
+
temperature=0.7,
|
| 30 |
+
convert_system_message_to_human= True
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
#User message
|
| 34 |
def get_text():
|
| 35 |
input_text=st.text_input("You: ", key=input)
|
| 36 |
return input_text
|
| 37 |
|
| 38 |
#Working with Responses
|
|
|
|
| 39 |
def load_answer(question):
|
| 40 |
#This is code, where we are adding new message to the model
|
| 41 |
st.session_state.sessionMessages.append(HumanMessage(content=question))
|