Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,26 @@ load_dotenv()
|
|
16 |
memory_storage = StreamlitChatMessageHistory(key="chat_messages")
|
17 |
memory = ConversationBufferWindowMemory(memory_key="chat_history", human_prefix="User", chat_memory=memory_storage, k=3)
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
def get_answer(query, chain):
|
20 |
try:
|
21 |
response = chain.invoke(query)
|
@@ -53,6 +73,15 @@ if st.button("Start Processing"):
|
|
53 |
else:
|
54 |
st.error("Please upload a file before starting processing.")
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
if user_input := st.chat_input("User Input"):
|
57 |
if 'chain' in st.session_state and 'image_vdb' in st.session_state:
|
58 |
chain = st.session_state['chain']
|
|
|
16 |
memory_storage = StreamlitChatMessageHistory(key="chat_messages")
|
17 |
memory = ConversationBufferWindowMemory(memory_key="chat_history", human_prefix="User", chat_memory=memory_storage, k=3)
|
18 |
|
19 |
+
image_bg = r"data/image/freepik-export-20240425023906eVmL.jpeg"
|
20 |
+
|
21 |
+
def add_bg_from_local(image_file):
|
22 |
+
with open(image_file, "rb") as image_file:
|
23 |
+
encoded_string = base64.b64encode(image_file.read())
|
24 |
+
st.markdown(f"""<style>.stApp {{background-image: url(data:image/{"png"};base64,{encoded_string.decode()});
|
25 |
+
background-size: cover}}</style>""", unsafe_allow_html=True)
|
26 |
+
add_bg_from_local(image_bg)
|
27 |
+
|
28 |
+
st.header("Welcome")
|
29 |
+
#st.set_page_config(layout='wide', page_title="Virtual Tutor")
|
30 |
+
st.markdown("""
|
31 |
+
<svg width="600" height="100">
|
32 |
+
<text x="50%" y="50%" font-family="San serif" font-size="42px" fill="Black" text-anchor="middle" stroke="white"
|
33 |
+
stroke-width="0.3" stroke-linejoin="round">MULTIMODAL RAG CHAT
|
34 |
+
</text>
|
35 |
+
</svg>
|
36 |
+
""", unsafe_allow_html=True)
|
37 |
+
|
38 |
+
|
39 |
def get_answer(query, chain):
|
40 |
try:
|
41 |
response = chain.invoke(query)
|
|
|
73 |
else:
|
74 |
st.error("Please upload a file before starting processing.")
|
75 |
|
76 |
+
st.markdown("""
|
77 |
+
<style>
|
78 |
+
.stChatInputContainer > div {
|
79 |
+
background-color: #000000;
|
80 |
+
}
|
81 |
+
</style>
|
82 |
+
""", unsafe_allow_html=True)
|
83 |
+
|
84 |
+
|
85 |
if user_input := st.chat_input("User Input"):
|
86 |
if 'chain' in st.session_state and 'image_vdb' in st.session_state:
|
87 |
chain = st.session_state['chain']
|