Spaces:
Sleeping
Sleeping
nileshhanotia
commited on
Commit
•
bf9a7e9
1
Parent(s):
94541f6
Update app.py
Browse files
app.py
CHANGED
@@ -147,14 +147,31 @@ def main():
|
|
147 |
trainer.train()
|
148 |
trainer.push_to_hub()
|
149 |
st.write(f"Model pushed to: {repo_id}")
|
150 |
-
|
151 |
# Integrate AppointmentScheduler
|
152 |
st.header("Appointment Scheduler")
|
153 |
scheduler = AppointmentScheduler()
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
user_input = st.text_input("Enter patient response")
|
155 |
if user_input:
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
response = scheduler.handle_incoming_speech(user_input)
|
157 |
-
st.
|
158 |
-
|
|
|
|
|
|
|
|
|
|
|
159 |
if __name__ == "__main__":
|
160 |
main()
|
|
|
147 |
trainer.train()
|
148 |
trainer.push_to_hub()
|
149 |
st.write(f"Model pushed to: {repo_id}")
|
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 |
+
|
172 |
+
# Display conversation history
|
173 |
+
for speaker, message in st.session_state.conversation_history:
|
174 |
+
st.write(f"{speaker}: {message}")
|
175 |
+
|
176 |
if __name__ == "__main__":
|
177 |
main()
|