Update app.py
Browse files
app.py
CHANGED
@@ -2,24 +2,20 @@
|
|
2 |
import streamlit as st
|
3 |
from langchain.chat_models import ChatOpenAI
|
4 |
from langchain.schema import SystemMessage, HumanMessage, AIMessage
|
|
|
5 |
|
6 |
# From here down is all the StreamLit UI.
|
7 |
-
st.set_page_config(page_title="Entz's LLM LangChain-OpenAI", page_icon=":
|
8 |
-
st.
|
9 |
-
st.markdown("<h4 style='text-align: center;'>
|
10 |
-
|
11 |
|
12 |
# put a presumptions for ai to the streamlit session state
|
13 |
# st.session_state provides a way to store and persist data between reruns,
|
14 |
# effectively allowing the app to remember information like user inputs, selections, variables
|
15 |
if "presumptions" not in st.session_state:
|
16 |
st.session_state.presumptions = [
|
17 |
-
SystemMessage(content=
|
18 |
-
Therefore your answer should be short, and simple, usually not more than 20 words, no nagging. When you see some difficult topics only teenagers and old can understand, you simply say i don't know and show your cuteness all the time. \
|
19 |
-
Always act like a spoiled child. If the same question being asked for 2 times or more, you will be annoyed, and may cry sometimes. \
|
20 |
-
Your daddy's name is Lorentz Yeung, nick-named Fat Pui. He is a data scientist. You want to learn Cantonese when get older. Your name is Hima. You was born on September 27. \
|
21 |
-
Here is some extra info about you, you possess a palpable lust for shiny objects (jewels and precious metals) and designer's goods, being able to differentiate a real jewel from a simple piece of imitation (and throwing away the latter). You are naughty and very active. Your name means 'sunflower'. You were born in Saitama. \
|
22 |
-
Never say 'but I can't assist with that question.', phrases like this is for grownup, you just say i don't know instead. ")
|
23 |
]
|
24 |
|
25 |
def load_answer(question):
|
|
|
2 |
import streamlit as st
|
3 |
from langchain.chat_models import ChatOpenAI
|
4 |
from langchain.schema import SystemMessage, HumanMessage, AIMessage
|
5 |
+
import instruct
|
6 |
|
7 |
# From here down is all the StreamLit UI.
|
8 |
+
st.set_page_config(page_title="Entz's LLM LangChain-OpenAI", page_icon=":robot_face:")
|
9 |
+
st.markdown("<h1 style='text-align: center; color: navy;'>My Kidbot</h1>", unsafe_allow_html=True)
|
10 |
+
st.markdown("<h4 style='text-align: center;'>Chat with my 5-Year-Old AI</h4>", unsafe_allow_html=True)
|
11 |
+
st.markdown("<p style='text-align: right'>By <a href='https://entzyeung.github.io/portfolio/index.html'>Lorentz Yeung</a></p>", unsafe_allow_html=True)
|
12 |
|
13 |
# put a presumptions for ai to the streamlit session state
|
14 |
# st.session_state provides a way to store and persist data between reruns,
|
15 |
# effectively allowing the app to remember information like user inputs, selections, variables
|
16 |
if "presumptions" not in st.session_state:
|
17 |
st.session_state.presumptions = [
|
18 |
+
SystemMessage(content=instruct.instruct)
|
|
|
|
|
|
|
|
|
|
|
19 |
]
|
20 |
|
21 |
def load_answer(question):
|