nileshhanotia commited on
Commit
2aad587
1 Parent(s): bf9a7e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -150,22 +150,23 @@ def main():
150
 
151
  # Integrate AppointmentScheduler
152
  st.header("Appointment Scheduler")
153
- scheduler = AppointmentScheduler()
154
 
155
- # Initialize session state for conversation history
156
  if 'conversation_history' not in st.session_state:
157
  st.session_state.conversation_history = []
 
158
  st.session_state.first_interaction = True
159
 
160
  user_input = st.text_input("Enter patient response")
161
  if user_input:
162
  # If it's the first interaction, start with the greeting
163
  if st.session_state.first_interaction:
164
- response = scheduler.handle_incoming_speech("hello")
165
  st.session_state.conversation_history.append(("Assistant", response))
166
  st.session_state.first_interaction = False
167
 
168
- response = scheduler.handle_incoming_speech(user_input)
 
169
  st.session_state.conversation_history.append(("Patient", user_input))
170
  st.session_state.conversation_history.append(("Assistant", response))
171
 
 
150
 
151
  # Integrate AppointmentScheduler
152
  st.header("Appointment Scheduler")
 
153
 
154
+ # Initialize session state for conversation history and scheduler
155
  if 'conversation_history' not in st.session_state:
156
  st.session_state.conversation_history = []
157
+ st.session_state.scheduler = AppointmentScheduler()
158
  st.session_state.first_interaction = True
159
 
160
  user_input = st.text_input("Enter patient response")
161
  if user_input:
162
  # If it's the first interaction, start with the greeting
163
  if st.session_state.first_interaction:
164
+ response = st.session_state.scheduler.handle_incoming_speech("hello")
165
  st.session_state.conversation_history.append(("Assistant", response))
166
  st.session_state.first_interaction = False
167
 
168
+ # Use AppointmentScheduler to handle the response
169
+ response = st.session_state.scheduler.handle_incoming_speech(user_input)
170
  st.session_state.conversation_history.append(("Patient", user_input))
171
  st.session_state.conversation_history.append(("Assistant", response))
172