File size: 2,747 Bytes
71d6a35 66d4edc 71d6a35 66d4edc 71d6a35 66d4edc 71d6a35 66d4edc 71d6a35 66d4edc 71d6a35 eb889b0 71d6a35 66d4edc 71d6a35 66d4edc 71d6a35 66d4edc 71d6a35 66d4edc 71d6a35 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
import streamlit as st
import os
import pandas as pd
from model import create_agent
from dotenv import load_dotenv
from config import PROMPT
# Set page config at the very beginning
st.set_page_config(page_title="Appointment Booking Bot", page_icon="π₯")
# Load doctor data
load_dotenv()
API_KEY = os.environ["API_KEY"]
# General prompt template
general_prompt_template=PROMPT
# Initialize the agent
@st.cache_resource
def get_agent():
return create_agent(general_prompt_template)
agent = get_agent()
# Streamlit app
st.title("Appointment Booking Bot")
st.write("**NOTE:** Currently the slots are getting booked/reshedule/delete in Google Calender in the specific account whose credentials are provided.")
# Initialize chat history
if "messages" not in st.session_state:
st.session_state.messages = []
# Display chat messages from history on app rerun
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.markdown(message["content"])
# React to user input
if prompt := st.chat_input("What is your query?"):
# Display user message in chat message container
st.chat_message("user").markdown(prompt)
# Add user message to chat history
st.session_state.messages.append({"role": "user", "content": prompt})
# agent=create_agent(general_prompt_template)
response = agent.invoke({"input": prompt})['output']
# Display assistant response in chat message container
with st.chat_message("assistant"):
st.markdown(response)
# Add assistant response to chat history
st.session_state.messages.append({"role": "assistant", "content": response})
# Main function to run the app
def main():
st.sidebar.title("About")
st.sidebar.info("""
π₯ **Appointment Booking Bot**
π©Ί Virtual Appointment Managing
π **Key Features:**
- Appointment management:
π
**Book appointments**
π **Reschedule appointments**
ποΈ **Delete appointments**
β° **Appointment Availability:**
- Monday to Friday
- 10 AM to 7 PM
- Book up to 7 days in advance
β οΈ **Important Note:**
This app is for managing your appointment using google Calender!
""")
# Display a horizontal line, emoji, and the name "SIMRAN"
col1, col2 = st.sidebar.columns([2, 1])
# Display emoji and name in the first column
with col1:
st.markdown("π€ **SIMRAN**") # Profile emoji next to the name
# Display red logout button in the second column
with col2:
logout_button = st.button("Logout", key="logout", help="Click to logout", use_container_width=True)
if __name__ == "__main__":
main() |