Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,21 @@ from vectorstore import load_or_build_vectorstore
|
|
9 |
from chain_setup import build_conversational_chain
|
10 |
|
11 |
def main():
|
12 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
# Paths and constants
|
15 |
local_file = "Policies001.pdf"
|
@@ -33,7 +47,8 @@ def main():
|
|
33 |
# Display existing messages
|
34 |
for msg in st.session_state["messages"]:
|
35 |
with st.chat_message(msg["role"]):
|
36 |
-
|
|
|
37 |
|
38 |
# Step 5: Chat Input
|
39 |
user_input = st.chat_input("اكتب سؤالك")
|
@@ -43,7 +58,7 @@ def main():
|
|
43 |
# a) Display user message
|
44 |
st.session_state["messages"].append({"role": "user", "content": user_input})
|
45 |
with st.chat_message("user"):
|
46 |
-
st.markdown(user_input)
|
47 |
|
48 |
# b) Run chain
|
49 |
response_dict = qa_chain({"question": user_input})
|
@@ -52,7 +67,7 @@ def main():
|
|
52 |
# c) Display assistant response
|
53 |
st.session_state["messages"].append({"role": "assistant", "content": answer})
|
54 |
with st.chat_message("assistant"):
|
55 |
-
st.markdown(answer)
|
56 |
|
57 |
if __name__ == "__main__":
|
58 |
main()
|
|
|
9 |
from chain_setup import build_conversational_chain
|
10 |
|
11 |
def main():
|
12 |
+
st.set_page_config(page_title="المحادثة التفاعلية", layout="wide")
|
13 |
+
st.title("💬 المحادثة التفاعلية - ادارة البيانات وحماية البيانات الشخصية")
|
14 |
+
|
15 |
+
# Add custom CSS to support right-to-left text
|
16 |
+
st.markdown(
|
17 |
+
"""
|
18 |
+
<style>
|
19 |
+
.rtl {
|
20 |
+
direction: rtl;
|
21 |
+
text-align: right;
|
22 |
+
}
|
23 |
+
</style>
|
24 |
+
""",
|
25 |
+
unsafe_allow_html=True,
|
26 |
+
)
|
27 |
|
28 |
# Paths and constants
|
29 |
local_file = "Policies001.pdf"
|
|
|
47 |
# Display existing messages
|
48 |
for msg in st.session_state["messages"]:
|
49 |
with st.chat_message(msg["role"]):
|
50 |
+
# Apply 'rtl' class for RTL text direction
|
51 |
+
st.markdown(f'<div class="rtl">{msg["content"]}</div>', unsafe_allow_html=True)
|
52 |
|
53 |
# Step 5: Chat Input
|
54 |
user_input = st.chat_input("اكتب سؤالك")
|
|
|
58 |
# a) Display user message
|
59 |
st.session_state["messages"].append({"role": "user", "content": user_input})
|
60 |
with st.chat_message("user"):
|
61 |
+
st.markdown(f'<div class="rtl">{user_input}</div>', unsafe_allow_html=True)
|
62 |
|
63 |
# b) Run chain
|
64 |
response_dict = qa_chain({"question": user_input})
|
|
|
67 |
# c) Display assistant response
|
68 |
st.session_state["messages"].append({"role": "assistant", "content": answer})
|
69 |
with st.chat_message("assistant"):
|
70 |
+
st.markdown(f'<div class="rtl">{answer}</div>', unsafe_allow_html=True)
|
71 |
|
72 |
if __name__ == "__main__":
|
73 |
main()
|