Jekyll2000 commited on
Commit
81e1697
·
verified ·
1 Parent(s): 5418dd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -43
app.py CHANGED
@@ -63,46 +63,29 @@ st.sidebar.title("Navigation")
63
  st.sidebar.write("Reclaim Your Mental Health")
64
  st.sidebar.markdown("[Visit us at](https://www.insighttherapysolutions.com/)")
65
 
66
- #rag_chain = RemoteRunnable("http://69.61.24.171:8000/rag_chain/")
67
-
68
-
69
-
70
- msgs = StreamlitChatMessageHistory(key="langchain_messages")
71
-
72
- # --- Main Content ---
73
- st.markdown("## 🔍 Chatbot For AI Engineer test:")
74
-
75
- if len(msgs.messages) == 0:
76
- msgs.add_ai_message("Hi! How can I assist you today?")
77
-
78
-
79
- for msg in msgs.messages:
80
- st.chat_message(msg.type).write(msg.content)
81
-
82
- if prompt := st.chat_input():
83
- st.chat_message("human").write(prompt)
84
-
85
- with st.chat_message("assistant"):
86
- message_placeholder = st.empty()
87
- full_response = ""
88
-
89
- try:
90
- _chat_history = st.session_state.langchain_messages[1:40]
91
- _chat_history_tranform = list(
92
- chunked([msg.content for msg in _chat_history], n=2)
93
- )
94
-
95
- response = rag_chain.stream(
96
- {"question": prompt, "chat_history": _chat_history_tranform}
97
- )
98
-
99
- for res in response:
100
- full_response += res or ""
101
- message_placeholder.markdown(full_response + "|")
102
- message_placeholder.markdown(full_response)
103
-
104
- msgs.add_user_message(prompt)
105
- msgs.add_ai_message(full_response)
106
-
107
- except Exception as e:
108
- st.error(f"An error occured. {e}")
 
63
  st.sidebar.write("Reclaim Your Mental Health")
64
  st.sidebar.markdown("[Visit us at](https://www.insighttherapysolutions.com/)")
65
 
66
+ # Add some custom styling
67
+ st.markdown(
68
+ """
69
+ <style>
70
+ .css-18e3th9 {
71
+ padding-top: 3rem;
72
+ }
73
+ .css-1d391kg {
74
+ text-align: center;
75
+ }
76
+ .stButton>button {
77
+ background-color: #4CAF50;
78
+ color: white;
79
+ border: none;
80
+ padding: 15px 32px;
81
+ text-align: center;
82
+ text-decoration: none;
83
+ display: inline-block;
84
+ font-size: 16px;
85
+ margin: 4px 2px;
86
+ cursor: pointer;
87
+ border-radius: 8px;
88
+ }
89
+ </style>
90
+ """, unsafe_allow_html=True
91
+ )