Update thicc/app.py
Browse files- thicc/app.py +28 -2
thicc/app.py
CHANGED
|
@@ -107,7 +107,9 @@ def respond(message, history):
|
|
| 107 |
hospitals_list = "\n".join(f"• {name}" for name in HOSPITAL_CHOICES)
|
| 108 |
plans_list = "\n".join(f"• {name}" for name in PLAN_CHOICES)
|
| 109 |
|
| 110 |
-
|
|
|
|
|
|
|
| 111 |
|
| 112 |
Before I can estimate your costs, tell me **which hospital** you're using and **what insurance plan** you have.
|
| 113 |
|
|
@@ -120,6 +122,30 @@ Before I can estimate your costs, tell me **which hospital** you're using and **
|
|
| 120 |
Please reply with something like:
|
| 121 |
• "I'm going to UCLA Medical Center and I have a PPO plan."
|
| 122 |
• "Cedars-Sinai Medical Center with No Insurance."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
"""
|
| 124 |
|
| 125 |
# --- 1) Coverage questions first ---
|
|
@@ -248,7 +274,7 @@ This estimate assumes your deductible has been met.
|
|
| 248 |
# Gradio interface
|
| 249 |
demo = gr.ChatInterface(
|
| 250 |
fn=respond,
|
| 251 |
-
title="THICC Cost Chatbot 🏥",
|
| 252 |
description="""Get healthcare cost estimates and understand your insurance coverage.
|
| 253 |
|
| 254 |
**What you can ask:**
|
|
|
|
| 107 |
hospitals_list = "\n".join(f"• {name}" for name in HOSPITAL_CHOICES)
|
| 108 |
plans_list = "\n".join(f"• {name}" for name in PLAN_CHOICES)
|
| 109 |
|
| 110 |
+
# Case 1: Both missing - show full welcome message
|
| 111 |
+
if hospital_name is None and plan_name is None:
|
| 112 |
+
return f"""Hi, I'm the THICC Cost Chatbot. 🏥
|
| 113 |
|
| 114 |
Before I can estimate your costs, tell me **which hospital** you're using and **what insurance plan** you have.
|
| 115 |
|
|
|
|
| 122 |
Please reply with something like:
|
| 123 |
• "I'm going to UCLA Medical Center and I have a PPO plan."
|
| 124 |
• "Cedars-Sinai Medical Center with No Insurance."
|
| 125 |
+
"""
|
| 126 |
+
|
| 127 |
+
# Case 2: Have hospital, need insurance plan
|
| 128 |
+
if hospital_name is not None and plan_name is None:
|
| 129 |
+
return f"""Great, I see you're going to **{hospital_name}**! 🏥
|
| 130 |
+
|
| 131 |
+
Now, what **insurance plan** do you have?
|
| 132 |
+
|
| 133 |
+
**Insurance options I support:**
|
| 134 |
+
{plans_list}
|
| 135 |
+
|
| 136 |
+
Please reply with your plan, like "PPO" or "No Insurance".
|
| 137 |
+
"""
|
| 138 |
+
|
| 139 |
+
# Case 3: Have insurance plan, need hospital
|
| 140 |
+
if hospital_name is None and plan_name is not None:
|
| 141 |
+
return f"""Got it, you have **{plan_name}**! 📋
|
| 142 |
+
|
| 143 |
+
Now, which **hospital** are you going to?
|
| 144 |
+
|
| 145 |
+
**Hospitals I currently support:**
|
| 146 |
+
{hospitals_list}
|
| 147 |
+
|
| 148 |
+
Please reply with the hospital name, like "UCLA Medical Center".
|
| 149 |
"""
|
| 150 |
|
| 151 |
# --- 1) Coverage questions first ---
|
|
|
|
| 274 |
# Gradio interface
|
| 275 |
demo = gr.ChatInterface(
|
| 276 |
fn=respond,
|
| 277 |
+
title="THICC Cost Chatbot - Now with Coverage Explanations! 🏥",
|
| 278 |
description="""Get healthcare cost estimates and understand your insurance coverage.
|
| 279 |
|
| 280 |
**What you can ask:**
|