Vela commited on
Commit
a8b8c9a
Β·
1 Parent(s): d091eda

modified frontend

Browse files
__pycache__/app.cpython-313.pyc DELETED
Binary file (213 Bytes)
 
src/frontend/app/__pycache__/common_functions.cpython-313.pyc CHANGED
Binary files a/src/frontend/app/__pycache__/common_functions.cpython-313.pyc and b/src/frontend/app/__pycache__/common_functions.cpython-313.pyc differ
 
src/frontend/app/__pycache__/pinecone_data_handler.cpython-313.pyc CHANGED
Binary files a/src/frontend/app/__pycache__/pinecone_data_handler.cpython-313.pyc and b/src/frontend/app/__pycache__/pinecone_data_handler.cpython-313.pyc differ
 
src/frontend/app/common_functions.py CHANGED
@@ -5,8 +5,6 @@ from dotenv import load_dotenv
5
  from utils import logger
6
  import json
7
  import time
8
- from datetime import datetime
9
- from typing import Dict, Any
10
  import streamlit as st
11
 
12
 
@@ -85,43 +83,10 @@ def upsert_data_request(start, end):
85
  response = requests.post(url, data=json.dumps(payload), headers=headers)
86
  return response.json()
87
  except requests.exceptions.HTTPError as http_err:
88
- print(f"HTTP error occurred: {http_err}")
89
  except Exception as err:
90
- print(f"An error occurred: {err}")
91
 
92
- # def initialize_conversation():
93
- # """
94
- # Initialize the conversation history with system and assistant messages.
95
-
96
- # Returns:
97
- # - list: Initialized conversation history.
98
- # """
99
- # assistant_message = (
100
- # "Hello! I am your Yuvabe Care Companion AI, here to assist you with general medicine queries. "
101
- # "I can provide information about common symptoms, medications, treatments, and wellness tips. "
102
- # "How can I help you today?"
103
- # )
104
-
105
- # conversation_history = [
106
- # {"role": "system", "content": "You are Yuvabe Care Companion AI, an advanced healthcare assistant designed to provide guidance on medical, mental health, and wellness topics."},
107
- # {"role": "system", "content": "Yuvabe Care Companion AI is powered by the LLaMA 3.3-70B Versatile model, optimized for comprehensive and responsible healthcare support."},
108
- # {"role": "system", "content": "Your knowledge is up-to-date with the latest medical guidelines as of July 2024, but you are NOT a replacement for professional medical advice."},
109
- # {"role": "system", "content": "Always provide accurate, empathetic, and responsible responses while reminding users to consult healthcare professionals when necessary."},
110
- # {"role": "system", "content": "You were created by Velu R, an AI model developer."},
111
- # {"role": "assistant", "content": assistant_message}
112
- # ]
113
- # return conversation_history
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
  def fetch_response(prompt, chat_history):
126
  try:
127
  # Prepare data for API request
@@ -230,41 +195,65 @@ def custom_navbar():
230
  justify-content: space-between;
231
  align-items: center;
232
  background-color: #F0F2F6;
233
- padding: 4px 24px;
234
  margin-top: -30px;
235
  width: 100%;
 
236
  border-radius: 32px;
237
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
238
  border: 1px solid #D1D5DB;
 
 
 
 
239
  }
240
 
241
  .logo {
242
  font-family: 'Arial', sans-serif;
243
- font-size: 30px; /* Slightly larger for better visibility */
244
  font-weight: bold;
245
- color: #1E293B; /* Darker tone for professional appeal */
 
 
 
246
  }
247
 
248
  .nav-links {
249
  display: flex;
250
- gap: 32px; /* Wider spacing for clarity */
251
  align-items: center;
 
252
  }
253
 
254
  .nav-link {
255
- color: #1E293B !important; /* Darker color for consistency */
256
  background-color: transparent;
257
  text-decoration: none;
258
  font-weight: 600;
259
- font-size: 18px; /* Improved readability */
260
- padding: 6px 16px; /* Balanced padding */
261
- border-radius: 8px; /* Rounded edges for clickable elements */
262
- transition: background-color 0.3s ease, color 0.3s ease; /* Smooth hover effects */
 
263
  }
264
 
265
  .nav-link:hover {
266
- background-color: #2E5D5B; /* Distinctive hover effect */
267
- color: #FFFFFF; /* White text for contrast */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  }
269
 
270
  </style>
 
5
  from utils import logger
6
  import json
7
  import time
 
 
8
  import streamlit as st
9
 
10
 
 
83
  response = requests.post(url, data=json.dumps(payload), headers=headers)
84
  return response.json()
85
  except requests.exceptions.HTTPError as http_err:
86
+ logger.info(f"HTTP error occurred: {http_err}")
87
  except Exception as err:
88
+ logger.info(f"An error occurred: {err}")
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  def fetch_response(prompt, chat_history):
91
  try:
92
  # Prepare data for API request
 
195
  justify-content: space-between;
196
  align-items: center;
197
  background-color: #F0F2F6;
198
+ padding: 12px 32px;
199
  margin-top: -30px;
200
  width: 100%;
201
+ max-width: 1200px;
202
  border-radius: 32px;
203
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
204
  border: 1px solid #D1D5DB;
205
+ margin-left: auto;
206
+ margin-right: auto;
207
+ box-sizing: border-box;
208
+ flex-wrap: wrap;
209
  }
210
 
211
  .logo {
212
  font-family: 'Arial', sans-serif;
213
+ font-size: 30px;
214
  font-weight: bold;
215
+ color: #1E293B;
216
+ white-space: nowrap;
217
+ text-overflow: ellipsis;
218
+ flex-wrap: wrap;
219
  }
220
 
221
  .nav-links {
222
  display: flex;
223
+ gap: 32px;
224
  align-items: center;
225
+ flex-wrap: wrap;
226
  }
227
 
228
  .nav-link {
229
+ color: #1E293B !important;
230
  background-color: transparent;
231
  text-decoration: none;
232
  font-weight: 600;
233
+ font-size: 18px;
234
+ padding: 6px 16px;
235
+ border-radius: 8px;
236
+ transition: background-color 0.3s ease, color 0.3s ease;
237
+ white-space: nowrap;
238
  }
239
 
240
  .nav-link:hover {
241
+ background-color: #2E5D5B;
242
+ color: #FFFFFF;
243
+ }
244
+
245
+ @media (max-width: 768px) {
246
+ .navbar {
247
+ flex-direction: column;
248
+ text-align: center;
249
+ padding: 12px 16px; /* Adjusted padding for smaller screens */
250
+ }
251
+
252
+ .nav-links {
253
+ flex-direction: column;
254
+ gap: 12px;
255
+ margin-top: 8px;
256
+ }
257
  }
258
 
259
  </style>
src/frontend/home.py CHANGED
@@ -15,9 +15,12 @@ def render_homepage():
15
  # Feature Overview Section
16
  text = ("""
17
  Key Features
 
18
  - Admin Portal β€” Effortlessly manage records, track data, and configure settings with ease.
 
19
  - Knowledge Base Explorer β€” Discover precise and relevant insights using advanced vector search technology.
20
- - Patient Assistance β€” Receive personalized guidance to articulate your health concerns effectively.
 
21
 
22
  > πŸ’‘ Explore each section to unlock powerful features tailored to enhance your experience.
23
  """)
 
15
  # Feature Overview Section
16
  text = ("""
17
  Key Features
18
+
19
  - Admin Portal β€” Effortlessly manage records, track data, and configure settings with ease.
20
+
21
  - Knowledge Base Explorer β€” Discover precise and relevant insights using advanced vector search technology.
22
+
23
+ - Chat with Us β€” Engage with our intelligent assistant for personalized guidance, helping you articulate your health concerns with clarity and confidence.
24
 
25
  > πŸ’‘ Explore each section to unlock powerful features tailored to enhance your experience.
26
  """)
src/frontend/images/chat_doctor_logo.png ADDED

Git LFS Details

  • SHA256: 9c5983ae3fd43bffc84f3782b51e2318006896eb945e82af0403f62534dab160
  • Pointer size: 133 Bytes
  • Size of remote file: 10.3 MB
src/frontend/images/healthy.png ADDED

Git LFS Details

  • SHA256: 419dfe7ab38c12ff1e1c328190b62aa05251a247a79ac32b1c71004e4406b1a1
  • Pointer size: 130 Bytes
  • Size of remote file: 42.1 kB
src/frontend/pages/chatbot.py CHANGED
@@ -7,7 +7,7 @@ API_URL = "http://localhost:8000/chat/get-health-advice/"
7
  NUMBER_OF_MESSAGES_TO_DISPLAY = 20
8
  common_functions.config_homepage()
9
  common_functions.set_page_title()
10
- common_functions.set_bg_image("src/frontend/images/health_care_baner_3.gif")
11
  # Initialize conversation history
12
  def initialize_conversation():
13
  assistant_message = ("Hello! I am your Yuvabe Care Companion AI, here to assist you with general medicine queries. "
@@ -41,7 +41,7 @@ def render_chatbot():
41
  # Display chat history
42
  for message in st.session_state.conversation_history [-NUMBER_OF_MESSAGES_TO_DISPLAY:]:
43
  role = message["role"]
44
- avatar_image = "src/frontend/images/page_icon.jpg" if role == "assistant" else "src/frontend/images/page_icon.jpg" if role == "user" else None
45
  with st.chat_message(role, avatar=avatar_image):
46
  st.write(message["content"])
47
 
@@ -57,7 +57,8 @@ def render_chatbot():
57
  if user_input:
58
 
59
  # Display user's input
60
- with st.chat_message('user'):
 
61
  common_functions.typewriter_effect(user_input)
62
 
63
  # Append user input to session history
@@ -71,7 +72,8 @@ def render_chatbot():
71
  common_functions.store_chat_history_in_db(st.session_state.conversation_id,st.session_state.conversation_history)
72
 
73
  # Display only the assistant's latest response
74
- with st.chat_message('assistant'):
 
75
  common_functions.typewriter_effect(assistant_reply)
76
 
77
  render_chatbot()
 
7
  NUMBER_OF_MESSAGES_TO_DISPLAY = 20
8
  common_functions.config_homepage()
9
  common_functions.set_page_title()
10
+ common_functions.set_bg_image("src/frontend/images/health_care_baner_2.jpg")
11
  # Initialize conversation history
12
  def initialize_conversation():
13
  assistant_message = ("Hello! I am your Yuvabe Care Companion AI, here to assist you with general medicine queries. "
 
41
  # Display chat history
42
  for message in st.session_state.conversation_history [-NUMBER_OF_MESSAGES_TO_DISPLAY:]:
43
  role = message["role"]
44
+ avatar_image = "src/frontend/images/chat_doctor_logo.png" if role == "assistant" else "src/frontend/images/healthy.png" if role == "user" else None
45
  with st.chat_message(role, avatar=avatar_image):
46
  st.write(message["content"])
47
 
 
57
  if user_input:
58
 
59
  # Display user's input
60
+ user_avatar_image = "src/frontend/images/healthy.png"
61
+ with st.chat_message('user',avatar=user_avatar_image):
62
  common_functions.typewriter_effect(user_input)
63
 
64
  # Append user input to session history
 
72
  common_functions.store_chat_history_in_db(st.session_state.conversation_id,st.session_state.conversation_history)
73
 
74
  # Display only the assistant's latest response
75
+ doctor_avatar_image = "src/frontend/images/chat_doctor_logo.png"
76
+ with st.chat_message('assistant',avatar=doctor_avatar_image):
77
  common_functions.typewriter_effect(assistant_reply)
78
 
79
  render_chatbot()