hashirehtisham commited on
Commit
361758a
1 Parent(s): 09d61eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -12
app.py CHANGED
@@ -17,24 +17,39 @@ st.set_page_config(
17
  st.markdown(
18
  """
19
  <style>
 
 
 
 
 
20
  .main {
21
- background-color: #f0f4f8;
 
22
  }
23
  .sidebar .sidebar-content {
24
- background-color: #003366;
 
25
  }
26
  .stButton>button {
27
- color: #FFFFFF;
28
- background-color: #003366;
29
  }
30
  .stChatMessage--assistant {
31
- background-color: #e0f7fa;
 
32
  }
33
  .stChatMessage--user {
34
- background-color: #ffffff;
 
35
  }
36
  .title {
37
- color: #003366;
 
 
 
 
 
 
38
  }
39
  </style>
40
  """,
@@ -73,17 +88,19 @@ if "messages" not in st.session_state:
73
  st.session_state.max_tokens = 512
74
  st.session_state.temperature = 0.7
75
  st.session_state.top_p = 0.95
76
- instruction = "Hi! This is your Legal Ease 🧑‍⚖️. Please describe your legal question or issue. For example: 'I need help understanding a contract clause.'"
 
 
77
  st.session_state.messages.append({"role": "assistant", "content": instruction})
78
 
79
  # Display the existing chat messages via st.chat_message.
80
  for message in st.session_state.messages:
81
  if message["role"] == "assistant":
82
  with st.chat_message("assistant"):
83
- st.markdown(message["content"])
84
  elif message["role"] == "user":
85
  with st.chat_message("user"):
86
- st.markdown(message["content"])
87
 
88
  # Create a chat input field to allow the user to enter a message. This will display
89
  # automatically at the bottom of the page.
@@ -92,7 +109,7 @@ if prompt := st.chat_input("What legal question or issue do you need help with?"
92
  # Store and display the current prompt.
93
  st.session_state.messages.append({"role": "user", "content": prompt})
94
  with st.chat_message("user"):
95
- st.markdown(prompt)
96
 
97
  # Generate a response using the AI71 API.
98
  with st.spinner("Generating response..."):
@@ -116,7 +133,7 @@ if prompt := st.chat_input("What legal question or issue do you need help with?"
116
 
117
  # Stream the full response to the chat using st.write
118
  with st.chat_message("assistant"):
119
- st.markdown(full_response)
120
 
121
  st.session_state.messages.append({"role": "assistant", "content": full_response})
122
  except Exception as e:
 
17
  st.markdown(
18
  """
19
  <style>
20
+ /* Set a light background and dark text color to ensure visibility in dark mode */
21
+ body {
22
+ background-color: #ffffff; /* White background */
23
+ color: #000000; /* Black text */
24
+ }
25
  .main {
26
+ background-color: #f0f4f8; /* Light background */
27
+ color: #000000; /* Black text */
28
  }
29
  .sidebar .sidebar-content {
30
+ background-color: #003366; /* Dark blue sidebar background */
31
+ color: #ffffff; /* White text in the sidebar */
32
  }
33
  .stButton>button {
34
+ color: #FFFFFF; /* White text for buttons */
35
+ background-color: #003366; /* Dark blue button background */
36
  }
37
  .stChatMessage--assistant {
38
+ background-color: #e0f7fa; /* Light cyan background for assistant messages */
39
+ color: #000000; /* Black text for assistant messages */
40
  }
41
  .stChatMessage--user {
42
+ background-color: #ffffff; /* White background for user messages */
43
+ color: #000000; /* Black text for user messages */
44
  }
45
  .title {
46
+ color: #003366; /* Dark title color */
47
+ }
48
+ .initial-message {
49
+ color: #000000; /* Black text for the initial message */
50
+ }
51
+ .message-content {
52
+ color: #000000 !important; /* Black text for all messages */
53
  }
54
  </style>
55
  """,
 
88
  st.session_state.max_tokens = 512
89
  st.session_state.temperature = 0.7
90
  st.session_state.top_p = 0.95
91
+ instruction = ("<span class='initial-message'>Hi! This is your Legal Ease 🧑‍⚖️. "
92
+ "Please describe your legal question or issue. For example: 'I need help "
93
+ "understanding a contract clause.'</span>")
94
  st.session_state.messages.append({"role": "assistant", "content": instruction})
95
 
96
  # Display the existing chat messages via st.chat_message.
97
  for message in st.session_state.messages:
98
  if message["role"] == "assistant":
99
  with st.chat_message("assistant"):
100
+ st.markdown(f"<div class='message-content'>{message['content']}</div>", unsafe_allow_html=True)
101
  elif message["role"] == "user":
102
  with st.chat_message("user"):
103
+ st.markdown(f"<div class='message-content'>{message['content']}</div>", unsafe_allow_html=True)
104
 
105
  # Create a chat input field to allow the user to enter a message. This will display
106
  # automatically at the bottom of the page.
 
109
  # Store and display the current prompt.
110
  st.session_state.messages.append({"role": "user", "content": prompt})
111
  with st.chat_message("user"):
112
+ st.markdown(f"<div class='message-content'>{prompt}</div>", unsafe_allow_html=True)
113
 
114
  # Generate a response using the AI71 API.
115
  with st.spinner("Generating response..."):
 
133
 
134
  # Stream the full response to the chat using st.write
135
  with st.chat_message("assistant"):
136
+ st.markdown(f"<div class='message-content'>{full_response}</div>", unsafe_allow_html=True)
137
 
138
  st.session_state.messages.append({"role": "assistant", "content": full_response})
139
  except Exception as e: