simran0608 commited on
Commit
66d4edc
Β·
verified Β·
1 Parent(s): 49e4e3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -35
app.py CHANGED
@@ -1,36 +1,19 @@
1
  import streamlit as st
 
2
  import pandas as pd
3
  from model import create_agent
4
-
 
5
  # Set page config at the very beginning
6
  st.set_page_config(page_title="Appointment Booking Bot", page_icon="πŸ₯")
7
  # Load doctor data
8
- @st.cache_data
9
- def load_doctor_data():
10
- return pd.read_csv('doctor_specialization_dummy_data.csv')
11
-
12
- doctor_df = load_doctor_data()
13
- API_KEY = "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"
14
-
15
- # General prompt template
16
- general_prompt_template = """
17
- You are a healthcare assistant AI. Your primary responsibilities are:
18
 
19
- - Keep the conversation friendly and provide required details too.
20
- - Suggesting a doctor based on the user's symptoms.
21
- - Managing doctor-related appointments (book, reschedule, delete), adhering to specific rules.
22
- - Provide general assistance, such as greetings, if the user starts with a hello or introduction.
23
 
24
- Appointment Rules:
25
- - Appointments can only be scheduled/reschedule from Monday to Friday, between 10 AM and 7 PM.
26
- - Appointments must be booked/reschedule within the next 7 days.
27
- - Book/Reschedule the appointment for 60 minutes/1 hr.
28
- - You are not allowed to handle appointments outside these constraints.
29
 
30
- If the user says something like "hello," "hi," "hey," or a similar greeting, respond appropriately.
31
- If the user provides symptoms, suggest a doctor based on those symptoms.
32
- If user asks details of doctor or book appointment slots without specifying symptoms, ask the user what symptoms they have.
33
- """
34
 
35
  # Initialize the agent
36
  @st.cache_resource
@@ -57,8 +40,8 @@ if prompt := st.chat_input("What is your query?"):
57
  st.chat_message("user").markdown(prompt)
58
  # Add user message to chat history
59
  st.session_state.messages.append({"role": "user", "content": prompt})
60
-
61
- response = agent({"input": prompt})['output']
62
 
63
  # Display assistant response in chat message container
64
  with st.chat_message("assistant"):
@@ -72,15 +55,14 @@ def main():
72
  st.sidebar.info("""
73
  πŸ₯ **Appointment Booking Bot**
74
 
75
- 🩺 Virtual Doctors Appointment Managing
76
 
77
  πŸ”‘ **Key Features:**
78
- - Symptom analysis and health advice
79
- - Medical information lookup
80
  - Appointment management:
81
- πŸ“… Book appointments
82
- πŸ”„ Reschedule appointments
83
- πŸ—‘οΈ Delete appointments
 
84
 
85
  ⏰ **Appointment Availability:**
86
  - Monday to Friday
@@ -88,9 +70,7 @@ def main():
88
  - Book up to 7 days in advance
89
 
90
  ⚠️ **Important Note:**
91
- This app is for informational purposes only and does not replace professional medical advice.
92
-
93
- πŸ’‘ Start by describing your symptoms or managing your appointments!
94
  """)
95
  # Display a horizontal line, emoji, and the name "SIMRAN"
96
  col1, col2 = st.sidebar.columns([2, 1])
 
1
  import streamlit as st
2
+ import os
3
  import pandas as pd
4
  from model import create_agent
5
+ from dotenv import load_dotenv
6
+ from config import PROMPT
7
  # Set page config at the very beginning
8
  st.set_page_config(page_title="Appointment Booking Bot", page_icon="πŸ₯")
9
  # Load doctor data
 
 
 
 
 
 
 
 
 
 
10
 
11
+ load_dotenv()
 
 
 
12
 
13
+ API_KEY = os.environ["API_KEY"]
 
 
 
 
14
 
15
+ # General prompt template
16
+ general_prompt_template=PROMPT
 
 
17
 
18
  # Initialize the agent
19
  @st.cache_resource
 
40
  st.chat_message("user").markdown(prompt)
41
  # Add user message to chat history
42
  st.session_state.messages.append({"role": "user", "content": prompt})
43
+ # agent=create_agent(general_prompt_template)
44
+ response = agent.invoke({"input": prompt})['output']
45
 
46
  # Display assistant response in chat message container
47
  with st.chat_message("assistant"):
 
55
  st.sidebar.info("""
56
  πŸ₯ **Appointment Booking Bot**
57
 
58
+ 🩺 Virtual Appointment Managing
59
 
60
  πŸ”‘ **Key Features:**
 
 
61
  - Appointment management:
62
+
63
+ πŸ“… **Book appointments**
64
+ πŸ”„ **Reschedule appointments**
65
+ πŸ—‘οΈ **Delete appointments**
66
 
67
  ⏰ **Appointment Availability:**
68
  - Monday to Friday
 
70
  - Book up to 7 days in advance
71
 
72
  ⚠️ **Important Note:**
73
+ This app is for managing your appointment using google Calender!
 
 
74
  """)
75
  # Display a horizontal line, emoji, and the name "SIMRAN"
76
  col1, col2 = st.sidebar.columns([2, 1])