sandeepgiri908 commited on
Commit
925a8ef
·
verified ·
1 Parent(s): b09ef36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -88,6 +88,11 @@ def get_psychiatrists_by_location(state):
88
 
89
  def chatbot_interface(user_message, country, state):
90
  try:
 
 
 
 
 
91
  if user_message.lower() == "exit":
92
  return "Chatbot: Take care of yourself. Goodbye! ❤️"
93
 
@@ -113,6 +118,7 @@ def chatbot_interface(user_message, country, state):
113
  print("❌ ERROR DETECTED:\n", error_message)
114
  return f"⚠️ Error in chatbot: {str(e)}"
115
 
 
116
  gr.Interface(
117
  fn=chatbot_interface,
118
  inputs=[
@@ -122,4 +128,4 @@ gr.Interface(
122
  ],
123
  outputs=gr.Textbox(label="Output"),
124
  theme="soft"
125
- ).launch()
 
88
 
89
  def chatbot_interface(user_message, country, state):
90
  try:
91
+ # Ensure default values if inputs are None
92
+ user_message = user_message or "" # Default empty string if None
93
+ country = country or "Other" # Default to "Other"
94
+ state = state or "" # Default empty string
95
+
96
  if user_message.lower() == "exit":
97
  return "Chatbot: Take care of yourself. Goodbye! ❤️"
98
 
 
118
  print("❌ ERROR DETECTED:\n", error_message)
119
  return f"⚠️ Error in chatbot: {str(e)}"
120
 
121
+
122
  gr.Interface(
123
  fn=chatbot_interface,
124
  inputs=[
 
128
  ],
129
  outputs=gr.Textbox(label="Output"),
130
  theme="soft"
131
+ ).launch(share=True)