Update app.py
Browse files
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 |
-
|
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 |
-
|
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 |
-
|
31 |
-
|
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
|
76 |
|
77 |
π **Key Features:**
|
78 |
-
- Symptom analysis and health advice
|
79 |
-
- Medical information lookup
|
80 |
- Appointment management:
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
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
|
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])
|